From 20be0847c80624290d669e4228062d2dcfc8819b Mon Sep 17 00:00:00 2001 From: Yuan Chang Date: Wed, 9 Aug 2023 22:20:59 +0800 Subject: [PATCH] Add `into_inner` methods. (#3110) --- crates/epaint/src/mutex.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/crates/epaint/src/mutex.rs b/crates/epaint/src/mutex.rs index f3a18bf1..cca86466 100644 --- a/crates/epaint/src/mutex.rs +++ b/crates/epaint/src/mutex.rs @@ -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 Drop for MutexGuard<'_, T> { @@ -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 { @@ -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() + } } } @@ -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() + } } }