[][src]Trait evaluator::Evaluator

pub trait Evaluator {
    type Output;
    fn eval(&mut self) -> Self::Output;
}

An interface for immediate evaluation (without caching) for any types and cached (lazy) evaluation for types that implement Clone, including those that implement Copy, integers and floats being the simplest examples.

Associated Types

type Output

The type that the evaluator evaluates to.

Loading content...

Required methods

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

Evaluates and returns the result. Because evaluators may possibly involve caching, a mutable borrow of self is required. Thus all evaluators must be mutable.

Panics

Panicking of this function is not defined or restricted. Refer to the documentation of implementing structs for more information.

Loading content...

Implementors

impl<Out> Evaluator for DummyEval<Out> where
    Out: Clone
[src]

type Output = Out

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

Evaluates and returns the result. This includes the overhead of cloning the value, because the fixed value must be preserved.

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

Panics

May panic only if cloning of the inner value panics.

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

type Output = Out

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> Evaluator for ImmEval<Out, Cl> where
    Cl: FnMut() -> Out, 
[src]

type Output = Out

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

Evaluates and returns the result. Because evaluators may possibly involve caching, a mutable borrow of self is required by the Evaluator trait, though immediate evaluators do not involve any.

Panics

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

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

type Output = Out

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.

Loading content...