[][src]Struct spinning::Once

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

A synchronization primitive which initializes a value lazily, once. Since this also includes a value, it is a bit more like Once from parking_lot or spin.

Implementations

impl<T> Once<T>[src]

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

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

pub const fn initialized(value: T) -> Self[src]

pub fn initialize(&self, value: T) -> Result<(), T>[src]

pub fn try_call_once<'a, F>(&'a self, init: F) -> Result<&'a T, F> where
    F: FnOnce() -> T, 
[src]

pub fn call_once<'a, F>(&'a self, init: F) -> &'a T where
    F: FnOnce() -> T, 
[src]

pub fn wait<'a>(&'a self) -> &'a T[src]

pub fn try_get<'a>(&'a self) -> Option<&'a T>[src]

pub fn state(&self) -> OnceState[src]

Trait Implementations

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

impl<T> Drop for Once<T>[src]

impl<T: RefUnwindSafe> RefUnwindSafe for Once<T>[src]

impl<T: Send + Sync> Send for Once<T>[src]

impl<T: Send + Sync> Sync for Once<T>[src]

impl<T: UnwindSafe> UnwindSafe for Once<T>[src]

Auto Trait Implementations

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

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.