[][src]Struct evaluator::RcEval

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

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

Methods

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

pub fn flush(&mut self)[src]

Disowns the cached value (destroying it if there are no other owners), 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 RcEval<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 RcEval<Out, Cl> where
    Cl: FnMut() -> Out, 
[src]

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

Constructs the evaluator from the specified closure.

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

type Output = Out

The type that the evaluator evaluates to.

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

Evaluates and returns an std::rc::Rc to the result.

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.

Auto Trait Implementations

impl<Out, Cl> !RefUnwindSafe for RcEval<Out, Cl>

impl<Out, Cl> !Send for RcEval<Out, Cl>

impl<Out, Cl> !Sync for RcEval<Out, Cl>

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

impl<Out, Cl> UnwindSafe for RcEval<Out, Cl> where
    Cl: UnwindSafe,
    Out: RefUnwindSafe

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.