pub struct Mutex<T: ?Sized> { /* private fields */ }Expand description
An async mutex: .lock().await yields the calling task (not the OS
thread) while the lock is held elsewhere, instead of blocking it.
§Errors
None of this type’s methods can fail (no lock poisoning — a panic
while holding the guard simply unlocks on unwind, matching
tokio::sync::Mutex’s behavior, not std::sync::Mutex’s).
Implementations§
Source§impl<T> Mutex<T>
impl<T> Mutex<T>
Sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Consume the mutex, returning the guarded value.
Trait Implementations§
impl<T: ?Sized + Send> Send for Mutex<T>
impl<T: ?Sized + Send> Sync for Mutex<T>
Auto Trait Implementations§
impl<T> !Freeze for Mutex<T>
impl<T> !RefUnwindSafe for Mutex<T>
impl<T> Unpin for Mutex<T>
impl<T> UnsafeUnpin for Mutex<T>where
T: UnsafeUnpin + ?Sized,
impl<T> UnwindSafe for Mutex<T>where
T: UnwindSafe + ?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