[][src]Struct evaluator::Eval

pub struct Eval<Out, Cl> where
    Out: Clone,
    Cl: FnMut() -> Out, 
{ /* fields omitted */ }

Implements cached (lazy) evaluation of clonable types via closures.

Methods

impl<Out, Cl> Eval<Out, Cl> where
    Out: Clone,
    Cl: FnMut() -> Out, 
[src]

pub fn flush(&mut self)[src]

Invalidates the cached value, if there is one. If the evaluator was never used after creation or was recently flush()ed, does nothing.

Trait Implementations

impl<Out, Cl> Evaluator for Eval<Out, Cl> where
    Out: Clone,
    Cl: FnMut() -> Out, 
[src]

type Output = Out

The type that the evaluator evaluates to.

fn eval(&mut self) -> Self::Output[src]

Evaluates and returns the result. This includes the overhead of cloning the value, because the internal cache must be preserved. If you need to move the result every time it is evaluated, use ImmEval.

Because caching evaluators, as their name suggests, store the cached value inside themselves, a mutable borrow of self is required.

Panics

Panicking of this function is not defined or restricted and depends on the closure.

impl<Out, Cl> From<Cl> for Eval<Out, Cl> where
    Out: Clone,
    Cl: FnMut() -> Out, 
[src]

fn from(cl: Cl) -> Self[src]

Constructs the evaluator from the specified closure.

Auto Trait Implementations

impl<Out, Cl> RefUnwindSafe for Eval<Out, Cl> where
    Cl: RefUnwindSafe,
    Out: RefUnwindSafe

impl<Out, Cl> Send for Eval<Out, Cl> where
    Cl: Send,
    Out: Send

impl<Out, Cl> Sync for Eval<Out, Cl> where
    Cl: Sync,
    Out: Sync

impl<Out, Cl> Unpin for Eval<Out, Cl> where
    Cl: Unpin,
    Out: Unpin

impl<Out, Cl> UnwindSafe for Eval<Out, Cl> where
    Cl: UnwindSafe,
    Out: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<!> for T[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.