[−][src]Struct freezebox::FreezeBox
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]
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,
T: RefUnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,