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
§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
§fn new_handle(value: Arc<T>) -> Handle
fn new_handle(value: Arc<T>) -> Handle
Create a new handle for an Arc value Read more
§unsafe fn clone_handle(handle: Handle) -> Handle
unsafe fn clone_handle(handle: Handle) -> Handle
Clone a handle Read more
§unsafe fn consume_handle(handle: Handle) -> Arc<T>
unsafe fn consume_handle(handle: Handle) -> Arc<T>
Consume a handle, getting back the initial
Arc<> Read more