Struct thunk::unsync::Thunk
[−]
[src]
pub struct Thunk<T> { /* fields omitted */ }
A non-thread-safe Thunk
, representing a lazily computed value.
Trait Implementations
impl<T> Drop for Thunk<T>
[src]
impl<T> Borrow<T> for Thunk<T>
[src]
impl<T> BorrowMut<T> for Thunk<T>
[src]
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> AsRef<T> for Thunk<T>
[src]
fn as_ref(&self) -> &T
Performs the conversion.
impl<T> AsMut<T> for Thunk<T>
[src]
fn as_mut(&mut self) -> &mut T
Performs the conversion.
impl<T> Deref for Thunk<T>
[src]
type Target = T
The resulting type after dereferencing
fn deref(&self) -> &T
The method called to dereference a value
impl<T> DerefMut for Thunk<T>
[src]
fn deref_mut(&mut self) -> &mut T
The method called to mutably dereference a value
impl<T> From<T> for Thunk<T>
[src]
impl<T> LazyRef for Thunk<T>
[src]
fn defer<'a, F: FnBox() -> T + 'a>(f: F) -> Thunk<T> where
T: 'a,
T: 'a,
Defer a computation stored as a FnOnce
closure. Unwrapping/dereferencing will force the computation of the closure. The supplied closure must live as long as the type which the thunk computes. Read more
fn force(&self)
Manually force a thunk's computation.
fn computed(t: Self::Target) -> Self
Construct a thunk with a precomputed value. This means forcing the thunk is a no-op. Read more
impl<T> LazyMut for Thunk<T>
[src]
impl<T> Lazy for Thunk<T>
[src]
fn unwrap(self) -> T
Unwrap a thunk into its inner value. This forces the thunk.