Struct immutable_seq::lazy::Thunk [] [src]

pub struct Thunk<T>(_);

A lazily evaluated value.

Methods

impl<T> Thunk<T>
[src]

Create a lazily evaluated value from a proc that returns that value.

You can construct Thunk's manually using this, but the lazy! macro is preferred.

let expensive = Thunk::new(|| { println!("Evaluated!"); value(7u32) });
assert_eq!(*expensive, 7u32); // "Evaluated!" gets printed here.
assert_eq!(*expensive, 7u32); // Nothing printed.

Create a new, evaluated, thunk from a value.

Force evaluation of a thunk.

Trait Implementations

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

The resulting type after dereferencing

The method called to dereference a value

impl<T> Clone for Thunk<T>
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<T> Debug for Thunk<T> where T: Debug
[src]

Formats the value using the given formatter.