[−][src]Struct evaluator::RcEval
Implements cached (lazy) evaluation of clonable and non-clonable types via closures.
Methods
impl<Out, Cl> RcEval<Out, Cl> where
Cl: FnMut() -> Out,
[src]
Cl: FnMut() -> Out,
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]
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 RcEval<Out, Cl> where
Cl: FnMut() -> Out,
[src]
Cl: FnMut() -> Out,
impl<Out, Cl> RcEvaluator for RcEval<Out, Cl> where
Cl: FnMut() -> Out,
[src]
Cl: FnMut() -> Out,
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,
Cl: Unpin,
impl<Out, Cl> UnwindSafe for RcEval<Out, Cl> where
Cl: UnwindSafe,
Out: RefUnwindSafe,
Cl: UnwindSafe,
Out: RefUnwindSafe,
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>,