[][src]Struct futures_intrusive::sync::GenericMutex

pub struct GenericMutex<MutexType: RawMutex, T> { /* fields omitted */ }

A futures-aware mutex.

Methods

impl<MutexType: RawMutex, T> GenericMutex<MutexType, T>[src]

pub fn new(value: T, is_fair: bool) -> GenericMutex<MutexType, T>[src]

Creates a new futures-aware mutex.

is_fair defines whether the Mutex should behave be fair regarding the order of waiters. A fair Mutex will only allow the first waiter which tried to lock but failed to lock the Mutex once it's available again. Other waiters must wait until either this locking attempt completes, and the Mutex gets unlocked again, or until the MutexLockFuture which tried to gain the lock is dropped.

pub fn lock(&self) -> GenericMutexLockFuture<MutexType, T>[src]

Acquire the mutex asynchronously.

This method returns a future that will resolve once the mutex has been successfully acquired.

pub fn try_lock(&self) -> Option<GenericMutexGuard<MutexType, T>>[src]

Tries to acquire the mutex

If acquiring the mutex is successful, a GenericMutexGuard will be returned, which allows to access the contained data.

Otherwise None will be returned.

pub fn is_locked(&self) -> bool[src]

Returns whether the mutex is locked.

Trait Implementations

impl<MutexType: RawMutex, T: Debug> Debug for GenericMutex<MutexType, T>[src]

impl<T: Send, MutexType: RawMutex + Send> Send for GenericMutex<MutexType, T>[src]

impl<T: Send, MutexType: RawMutex + Sync> Sync for GenericMutex<MutexType, T>[src]

Auto Trait Implementations

impl<MutexType, T> !RefUnwindSafe for GenericMutex<MutexType, T>

impl<MutexType, T> Unpin for GenericMutex<MutexType, T> where
    MutexType: Unpin,
    T: Unpin

impl<MutexType, T> UnwindSafe for GenericMutex<MutexType, T> where
    MutexType: UnwindSafe,
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.