pub struct LockToken<T> { /* private fields */ }Expand description
A token indicating a locked interface.
Implementations§
Source§impl LockToken<Unlock>
impl LockToken<Unlock>
Sourcepub unsafe fn relinquish_locking(self) -> LockToken<ForgetUnlock>
pub unsafe fn relinquish_locking(self) -> LockToken<ForgetUnlock>
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.
Source§impl LockToken<ForgetUnlock>
impl LockToken<ForgetUnlock>
Sourcepub unsafe fn take_ownership(self) -> LockToken<Unlock>
pub unsafe fn take_ownership(self) -> LockToken<Unlock>
Takes ownership of the token and exchanges it with a token which unlocks the interface.
§Safety
Improper usage can unlock the interface multiple times.
Source§impl<T> LockToken<T>
impl<T> LockToken<T>
Sourcepub fn lock() -> LockToken<Unlock>
pub fn lock() -> LockToken<Unlock>
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.
Sourcepub unsafe fn assume_locked() -> LockToken<ForgetUnlock>
pub unsafe fn assume_locked() -> LockToken<ForgetUnlock>
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for LockToken<T>where
T: Freeze,
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> UnsafeUnpin for LockToken<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for LockToken<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more