[][src]Struct option_lock::OptionLock

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

A read-write lock around an Option value

Implementations

impl<T> OptionLock<T>[src]

pub const fn new() -> Self[src]

Create a new, empty instance.

pub unsafe fn get_unchecked(&self) -> &mut Option<T>[src]

Get an unsafe, mutable reference to the contained Option.

pub fn get_mut(&mut self) -> &mut Option<T>[src]

Get a safe mutable reference to the contained Option when holding the lock instance exclusively.

pub fn into_inner(self) -> Option<T>[src]

Unwrap an owned lock instance.

pub fn spin_lock(&self) -> OptionGuard<T>[src]

In a spin loop, wait to acquire the lock.

pub fn spin_take(&self) -> T[src]

In a spin loop, wait to take a value from the lock.

pub fn status(&self) -> Status[src]

Fetch the current status of the lock.

pub fn try_lock(&self) -> Result<OptionGuard<T>, TryLockError>[src]

Try to acquire an exclusive lock.

pub fn try_read(&self) -> Result<OptionRead<T>, ReadError>[src]

Try to acquire a read-only lock.

pub fn try_take(&self) -> Result<T, ReadError>[src]

Try to take a stored value from the lock.

Trait Implementations

impl<T> Debug for OptionLock<T>[src]

impl<T: Default> Default for OptionLock<T>[src]

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

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

impl<T: Send> Send for OptionLock<T>[src]

impl<T: Send> Sync for OptionLock<T>[src]

Auto Trait Implementations

impl<T> !RefUnwindSafe for OptionLock<T>

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

impl<T> UnwindSafe for OptionLock<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<!> for T[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.