Struct calc_graph::Lazy
source · pub struct Lazy<T, F>(_);
Expand description
Calculates a node’s value by calling a function on demand and caching the result.
Trait Implementations
sourceimpl<T: Clone, F: FnOnce() -> T> Calc for Lazy<T, F>
impl<T: Clone, F: FnOnce() -> T> Calc for Lazy<T, F>
type Value = T
type Value = T
The type of values calculated by the node.
sourcefn add_dep(&mut self, _seen: &mut BitSet, _dep: NonZeroUsize)
fn add_dep(&mut self, _seen: &mut BitSet, _dep: NonZeroUsize)
When this node is used as a precedent,
add_dep
is called by dependent nodes when they are created. Read moresourcefn eval(&mut self, _dirty: &mut BitSet) -> (NonZeroUsize, T)
fn eval(&mut self, _dirty: &mut BitSet) -> (NonZeroUsize, T)
Returns the value held within the node and the version number of the inputs used to calcuate that value.
The value is recalculated if needed. Read more
Auto Trait Implementations
impl<T, F> RefUnwindSafe for Lazy<T, F>where
F: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, F> Send for Lazy<T, F>where
F: Send,
T: Send,
impl<T, F> Sync for Lazy<T, F>where
F: Sync,
T: Sync,
impl<T, F> Unpin for Lazy<T, F>where
F: Unpin,
T: Unpin,
impl<T, F> UnwindSafe for Lazy<T, F>where
F: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more