Trait hala_sync::AsyncLockable
source · 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.
Object Safety§
This trait is not object safe.