Struct tramp::Thunk [−][src]
pub struct Thunk<T> { /* fields omitted */ }
A delayed computation. This can be used in lazy evaluation environments. Also, it is used to delay a tail call and emulate TCO (tail call optimization).
Methods
impl<T> Thunk<T>
[src]
impl<T> Thunk<T>
pub fn new(
fun: impl FnOnce() -> T + 'static
) -> Self
[src]
pub fn new(
fun: impl FnOnce() -> T + 'static
) -> Self
Creates a new thunk from the given function. Probably you will end up passing closures to this function.
pub fn compute(self) -> T
[src]
pub fn compute(self) -> T
Computes the result of this thunk, i.e. forces evaluation to happen.