Struct lazyonce::LazyOnce[][src]

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

Wrapper type for lazy initialization

Methods

impl<T> LazyOnce<T>
[src]

Get cached value, or if no value has been cached yet, compute it using the callback function.

If the callback panics, any use of the cell will panic, too.

Get cached value or None if the cell is still empty

Get mutable reference to the cached value, or if no value has been cached yet, compute it using the callback function.

Assume the value has already been computed. Crash if the cell is empty.

Panics

If get() hasn't been called yet.

Return computed value or None if the cell is empty.

Unlike try_get this returns an owned value, permanently "unwrapping" the cell.

Auto Trait Implementations

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

impl<T> Sync for LazyOnce<T> where
    T: Send