Trait thunk::LazyRef [] [src]

pub trait LazyRef<'a>: Deref + AsRef<Self::Target> + From<Self::Target> + 'a where
    Self::Target: Sized
{ fn defer<F: FnOnce() -> Self::Target + 'a>(_: F) -> Self; fn force(&self); fn computed(t: Self::Target) -> Self { ... } }

The LazyRef trait abstracts immutable references to lazily computed values.

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.

Provided Methods

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

Implementors