Struct emf_core_base_rs::global::LockToken[][src]

pub struct LockToken<T> { /* fields omitted */ }

A token indicating a locked interface.

Implementations

impl LockToken<Unlock>[src]

pub unsafe fn relinquish_locking(self) -> LockToken<ForgetUnlock>[src]

Takes ownership of the token and exchanges it with a token which does not unlock the interface.

Safety

Improper usage can leave the interface in a locked state.

impl LockToken<ForgetUnlock>[src]

pub unsafe fn take_ownership(self) -> LockToken<Unlock>[src]

Takes ownership of the token and exchanges it with a token which unlocks the interface.

Safety

Improper usage can unlock the interface multiple times.

impl<T> LockToken<T>[src]

#[must_use]
pub fn lock() -> LockToken<Unlock>
[src]

Constructs a new token by locking the interface.

The calling thread is stalled until the lock can be acquired. Only one thread can hold the lock at a time.

Return

A token.

#[must_use]
pub fn try_lock() -> Option<LockToken<Unlock>>
[src]

Tries to lock the interface.

The function fails if another thread already holds the lock.

Return

LockToken on success and None otherwise.

pub unsafe fn assume_locked() -> LockToken<ForgetUnlock>[src]

Constructs a new token without locking.

Return

A token.

Safety

Most of the interface assumes that the caller has unique access to the interface. This function can be used to bypass this restriction, if the user can guarantee that no data-races will occur.

Trait Implementations

impl<T: Debug> Debug for LockToken<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for LockToken<T> where
    T: RefUnwindSafe

impl<T> Send for LockToken<T> where
    T: Send

impl<T> Sync for LockToken<T> where
    T: Sync

impl<T> Unpin for LockToken<T> where
    T: Unpin

impl<T> UnwindSafe for LockToken<T> where
    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.