Struct tramp::Thunk [−][src]
pub struct Thunk<'a, 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<'a, T> Thunk<'a, T>[src]
impl<'a, T> Thunk<'a, T>pub fn new(
fun: impl FnOnce() -> T + 'a
) -> Self[src]
pub fn new(
fun: impl FnOnce() -> T + 'a
) -> SelfCreates 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) -> TComputes the result of this thunk, i.e. forces evaluation to happen.