[−][src]Struct evaluator::Eval
Implements cached (lazy) evaluation of clonable types via closures.
Methods
impl<Out, Cl> Eval<Out, Cl> where
Out: Clone,
Cl: FnMut() -> Out,
[src]
Out: Clone,
Cl: FnMut() -> Out,
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]
Out: Clone,
Cl: FnMut() -> Out,
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]
Out: Clone,
Cl: FnMut() -> Out,
Auto Trait Implementations
impl<Out, Cl> RefUnwindSafe for Eval<Out, Cl> where
Cl: RefUnwindSafe,
Out: RefUnwindSafe,
Cl: RefUnwindSafe,
Out: RefUnwindSafe,
impl<Out, Cl> Send for Eval<Out, Cl> where
Cl: Send,
Out: Send,
Cl: Send,
Out: Send,
impl<Out, Cl> Sync for Eval<Out, Cl> where
Cl: Sync,
Out: Sync,
Cl: Sync,
Out: Sync,
impl<Out, Cl> Unpin for Eval<Out, Cl> where
Cl: Unpin,
Out: Unpin,
Cl: Unpin,
Out: Unpin,
impl<Out, Cl> UnwindSafe for Eval<Out, Cl> where
Cl: UnwindSafe,
Out: UnwindSafe,
Cl: UnwindSafe,
Out: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[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]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,