Skip to content

Commit 858e3a5

Browse files
crumblingstatuehacknus
authored andcommitted
Make epaint::mutex::RwLock allow ?Sized types (emilk#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`.
1 parent 30aa213 commit 858e3a5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

crates/epaint/src/mutex.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,14 +133,16 @@ mod rw_lock_impl {
133133
/// the feature `deadlock_detection` is turned enabled, in which case
134134
/// extra checks are added to detect deadlocks.
135135
#[derive(Default)]
136-
pub struct RwLock<T>(parking_lot::RwLock<T>);
136+
pub struct RwLock<T: ?Sized>(parking_lot::RwLock<T>);
137137

138138
impl<T> RwLock<T> {
139139
#[inline(always)]
140140
pub fn new(val: T) -> Self {
141141
Self(parking_lot::RwLock::new(val))
142142
}
143+
}
143144

145+
impl<T: ?Sized> RwLock<T> {
144146
#[inline(always)]
145147
pub fn read(&self) -> RwLockReadGuard<'_, T> {
146148
parking_lot::RwLockReadGuard::map(self.0.read(), |v| v)

0 commit comments

Comments
 (0)