pub struct Mutex<T: ?Sized>(/* private fields */);
Expand description
A wrapper around std::sync::Mutex
that panics on poison.
This Mutex
works similarly to the standard library’s Mutex
, except its
lock
method does not return a Result
. Instead, if the mutex is poisoned,
it will panic.
§Examples
use matrix_sdk_common::locks::Mutex;
let mutex = Mutex::new(42);
{
let mut guard = mutex.lock();
*guard = 100;
}
assert_eq!(*mutex.lock(), 100);
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl<T> !Freeze for Mutex<T>
impl<T> RefUnwindSafe for Mutex<T>where
T: ?Sized,
impl<T> Send for Mutex<T>
impl<T> Sync for Mutex<T>
impl<T> Unpin for Mutex<T>
impl<T> UnwindSafe for Mutex<T>where
T: ?Sized,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CompatExt for T
impl<T> CompatExt for T
Source§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
Source§fn consume_handle(handle: Handle) -> Arc<T>
fn consume_handle(handle: Handle) -> Arc<T>
Consume a handle, getting back the initial
Arc<>