From acfe9f6f3b3eaff9a603c1568bd590948db52329 Mon Sep 17 00:00:00 2001 From: crumblingstatue Date: Mon, 13 May 2024 12:49:31 +0200 Subject: [PATCH] Make `epaint::mutex::RwLock` allow `?Sized` types (#4485) `parking_lot`'s `RwLock` allows this, so probably `epaint`'s `RwLock` should too. Although I'm not sure how much it's intended for users, rather than just internal use by `egui`. --- crates/epaint/src/mutex.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/epaint/src/mutex.rs b/crates/epaint/src/mutex.rs index 2c61f038f9c..157701c2be0 100644 --- a/crates/epaint/src/mutex.rs +++ b/crates/epaint/src/mutex.rs @@ -133,14 +133,16 @@ mod rw_lock_impl { /// the feature `deadlock_detection` is turned enabled, in which case /// extra checks are added to detect deadlocks. #[derive(Default)] - pub struct RwLock(parking_lot::RwLock); + pub struct RwLock(parking_lot::RwLock); impl RwLock { #[inline(always)] pub fn new(val: T) -> Self { Self(parking_lot::RwLock::new(val)) } + } + impl RwLock { #[inline(always)] pub fn read(&self) -> RwLockReadGuard<'_, T> { parking_lot::RwLockReadGuard::map(self.0.read(), |v| v)