Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make epaint::mutex::RwLock allow ?Sized types #4485

Merged
merged 1 commit into from
May 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion crates/epaint/src/mutex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<T>(parking_lot::RwLock<T>);
pub struct RwLock<T: ?Sized>(parking_lot::RwLock<T>);

impl<T> RwLock<T> {
#[inline(always)]
pub fn new(val: T) -> Self {
Self(parking_lot::RwLock::new(val))
}
}

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