pub struct Mutex<T> { /* private fields */ }
Expand description

A wrapper around std::sync::Mutex with an async lock method.

Implementations

Acquires the mutex, sleeping the current task until it is able to do so.

After this function returns, is the only task holding the lock.

The returned guard is an RAII scoped lock. It automatically unlocks the mutex when dropped (falls out of scope).

The returned guard is not Send so you cannot await while holding it.

If a task panics while holding the guard, the underlying mutex becomes “poisoned” and subsequent calls to lock will panic.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.