pub trait MutexExt<T> {
// Required methods
fn lock_safe(&self) -> T
where T: Clone;
fn lock_mut_safe(&self) -> MutexGuard<'_, T>;
}Expand description
Extension trait for Mutex to provide safe lock operations
Required Methods§
Sourcefn lock_safe(&self) -> Twhere
T: Clone,
fn lock_safe(&self) -> Twhere
T: Clone,
Lock the mutex, recovering from poison errors This is safer than unwrap() as it handles poisoned mutexes gracefully
Sourcefn lock_mut_safe(&self) -> MutexGuard<'_, T>
fn lock_mut_safe(&self) -> MutexGuard<'_, T>
Lock the mutex for mutation, recovering from poison errors
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".