[][src]Struct grin_util::OneTime

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

Encapsulation of a RwLock<Option> for one-time initialization. This implementation will purposefully fail hard if not used properly, for example if not initialized before being first used (borrowed).

Methods

impl<T> OneTime<T> where
    T: Clone
[src]

pub fn new() -> OneTime<T>
[src]

Builds a new uninitialized OneTime.

pub fn init(&self, value: T)
[src]

Initializes the OneTime, should only be called once after construction. Will panic (via assert) if called more than once.

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

Borrows the OneTime, should only be called after initialization. Will panic (via expect) if called before initialization.

Trait Implementations

impl<T: Clone> Clone for OneTime<T>
[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

Auto Trait Implementations

impl<T> Send for OneTime<T> where
    T: Send + Sync

impl<T> Sync for OneTime<T> where
    T: Send + Sync

Blanket Implementations

impl<T> From for T
[src]

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

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

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

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

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

impl<T> Erased for T

impl<T> CloneAny for T where
    T: Clone + Any

impl<T> UnsafeAny for T where
    T: Any