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

Provide into_inner() for egui::mutex::{Mutex, RwLock} #3110

Merged
merged 1 commit into from
Aug 9, 2023
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
20 changes: 20 additions & 0 deletions crates/epaint/src/mutex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ mod mutex_impl {

MutexGuard(self.0.lock(), ptr)
}

#[inline(always)]
pub fn into_inner(self) -> T {
self.0.into_inner()
}
}

impl<T> Drop for MutexGuard<'_, T> {
Expand Down Expand Up @@ -314,6 +319,11 @@ mod rw_lock_impl {
holders: Arc::clone(&self.holders),
}
}

#[inline(always)]
pub fn into_inner(self) -> T {
self.lock.into_inner()
}
}

fn make_backtrace() -> backtrace::Backtrace {
Expand Down Expand Up @@ -366,6 +376,11 @@ mod mutex_impl {
pub fn lock(&self) -> MutexGuard<'_, T> {
self.0.borrow_mut()
}

#[inline(always)]
pub fn into_inner(self) -> T {
self.0.into_inner()
}
}
}

Expand Down Expand Up @@ -401,6 +416,11 @@ mod rw_lock_impl {
pub fn write(&self) -> RwLockWriteGuard<'_, T> {
self.0.borrow_mut()
}

#[inline(always)]
pub fn into_inner(self) -> T {
self.0.into_inner()
}
}
}

Expand Down
Loading