pub trait MutexLike<T: Send + 'static>: Send + Sync {
type Guard<'guard>: DerefMut<Target = T> + Send
where Self: 'guard;
// Required method
fn lock(&self) -> impl Future<Output = Self::Guard<'_>> + Send;
}Expand description
Async mutex shape. The guard type is borrowed so callers can hold
the lock across an await without paying a clone. Implementations
supply the actual lock primitive — tokio::sync::Mutex<T> for the
tokio impl, a per-core single-writer lock for prime.
Required Associated Types§
Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".