[−][src]Struct tokio::sync::Mutex
This is supported on
feature="sync" only.An asynchronous mutual exclusion primitive useful for protecting shared data
Each mutex has a type parameter (T) which represents the data that it is protecting. The data
can only be accessed through the RAII guards returned from lock, which
guarantees that the data is only ever accessed when the mutex is locked.
Methods
impl<T> Mutex<T>[src]
pub fn new(t: T) -> Self[src]
This is supported on
feature="sync" and feature="sync" only.Creates a new lock in an unlocked state ready for use.
pub async fn lock<'_, '_>(&'_ self) -> MutexGuard<'_, T>[src]
This is supported on
feature="sync" and feature="sync" only.A future that resolves on acquiring the lock and returns the MutexGuard.
Trait Implementations
impl<T> Send for Mutex<T> where
T: Send, [src]
T: Send,
impl<T> Sync for Mutex<T> where
T: Send, [src]
T: Send,
impl<T> From<T> for Mutex<T>[src]
impl<T> Default for Mutex<T> where
T: Default, [src]
T: Default,
impl<T: Debug> Debug for Mutex<T>[src]
Auto Trait Implementations
impl<T> Unpin for Mutex<T> where
T: Unpin,
T: Unpin,
impl<T> !UnwindSafe for Mutex<T>
impl<T> !RefUnwindSafe for Mutex<T>
Blanket Implementations
impl<T> From<!> for T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = !
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,