Trait thunk::Lazy [] [src]

pub trait Lazy where
    Self: AsRef<Self::Target> + AsMut<Self::Target>,
    Self: Deref + DerefMut + From<Self::Target>,
    Self::Target: Sized
{ fn defer<F: FnOnce() -> Self::Target + 'static>(_: F) -> Self; fn force(&self); fn unwrap(self) -> Self::Target; fn computed(t: Self::Target) -> Self { ... } }

The Lazy trait abstracts lazily computed values, also known as "thunks".

Required Methods

Defer a computation stored as a FnOnce closure. Unwrapping/dereferencing will force the computation of the closure.

Manually force a thunk's computation.

Unwrap a thunk into its inner value. This forces the thunk.

Provided Methods

Construct a thunk with a precomputed value. This means unwrapping/dereferencing is effectively a no-op.

Implementors