Struct ruspiro_lock::async::AsyncMutex[][src]

pub struct AsyncMutex<T> { /* fields omitted */ }
Expand description

An async mutex lock that can be used in async functions to prevent blocking current execution while waiting for the lock to become available. So for this to work the lock() method does not return a MutexGuard immediately but a Future that will resove into a AsyncMutexGuard when awaited.

Implementations

Create the AsyncMutex

Locking the data secured by the AsyncMutex will yield a Future that must be awaited to actually acquire the lock.

Provide the inner data wrapped by this AsyncMutex. This will only provide the contained data if there is only one active reference to it. If the data is still shared more than once, eg. because there are active Futures awaiting a lock this will return the actual AsyncMutex in the Err variant.

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

Performs the conversion.

Performs the conversion.

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.