pub trait AsyncLockable {
type GuardMut<'a>: AsyncGuardMut<'a, Locker = Self> + Send + Unpin
where Self: 'a;
type GuardMutFuture<'a>: Future<Output = Self::GuardMut<'a>> + Send
where Self: 'a;
// Required methods
fn lock(&self) -> Self::GuardMutFuture<'_>;
fn unlock<'a>(guard: Self::GuardMut<'a>) -> &'a Self;
}Expand description
A futures-aware lockable mutex object should implement this trait.
Required Associated Types§
Sourcetype GuardMut<'a>: AsyncGuardMut<'a, Locker = Self> + Send + Unpin
where
Self: 'a
type GuardMut<'a>: AsyncGuardMut<'a, Locker = Self> + Send + Unpin where Self: 'a
RAII scoped lock guard type.
A guard of futures-aware mutex must be able to transfer between threads In other words, this guard must not track any thread-specific details
Required Methods§
Sourcefn lock(&self) -> Self::GuardMutFuture<'_>
fn lock(&self) -> Self::GuardMutFuture<'_>
Acquire the lock asynchronously.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.