[][src]Struct freezebox::FreezeBox

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

FreezeBox is a deref'able lazy-initialized container.

A FreezeBox<T> can have two possible states:

  • uninitialized: deref is not allowed.
  • initialized: deref to a &T is possible.

To upgrade a FreezeBox to the initialized state, call lazy_init. lazy_init does not require a mutable reference, making FreezeBox suitable for sharing objects first and initializing them later.

Attempting to lazy_init more than once, or deref while uninitialized will cause a panic.

Implementations

impl<T> FreezeBox<T>[src]

pub fn new() -> Self[src]

Create an uninitialized FreezeBox.

pub fn lazy_init(&self, val: T)[src]

Initialize a FreezeBox.

lazy_init will panic if the FreezeBox is already initialized.

Trait Implementations

impl<T> Default for FreezeBox<T>[src]

impl<T> Deref for FreezeBox<T>[src]

type Target = T

The resulting type after dereferencing.

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

Auto Trait Implementations

impl<T> RefUnwindSafe for FreezeBox<T>

impl<T> Send for FreezeBox<T>

impl<T> Sync for FreezeBox<T>

impl<T> Unpin for FreezeBox<T>

impl<T> UnwindSafe for FreezeBox<T> where
    T: RefUnwindSafe

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.