[−][src]Struct reax::computed::ComputedVar
A lazily computed variable that is tracked by the reax runtime.
Implementations
impl<C> ComputedVar<C>
[src]
pub fn new_raw(value: C) -> Self
[src]
Constructs a computed variable around the given
ComputedValue
. The dependencies of the
variable will be determined from the accesses made by the
update
function. Note
that update
will not be executed until someone retrieves the value of
this cell.
pub fn node(&self) -> &Node
[src]
Returns a handle to this computation's node in the dependency graph.
impl<T, F, C> ComputedVar<FunctionComputed<T, F, C>> where
F: FnMut(&mut C) -> T,
[src]
F: FnMut(&mut C) -> T,
pub fn new(func: F) -> Self
[src]
Constructs a computed variable. The value of the variable will be the set by the given function when needed. The dependencies of the variable will be determined from the accesses made by the given function. Note that the function will not be executed until someone retrieves the value of this cell.
To reuse buffers from past executions, use
new_mutate
.
impl<T, F, C> ComputedVar<MutatorComputed<T, F, C>> where
F: FnMut(&mut T, &mut C),
[src]
F: FnMut(&mut T, &mut C),
pub fn new_mutate(initial: T, func: F) -> Self
[src]
Constructs a computed variable. This is identical to
new
except the value of the variable will be mutated
by the given function when needed, not created from scratch.
impl<C: ComputedValue> ComputedVar<C>
[src]
pub fn get_contextual(&self, ctx: &mut C::Context) -> Ref<C::Value>
[src]
Identical to Variable::get
but
requires the update context.
pub fn get_contextual_non_reactive(&self, ctx: &mut C::Context) -> Ref<C::Value>
[src]
Identical to
Variable::get_non_reactive
but requires the update context.
pub fn boxed<'a>(self) -> BoxedComputedVar<'a, C::Value, C::Context> where
Self: 'a,
[src]
Self: 'a,
Creates a boxed version of this cell who's type does not depend on how the cell is updated.
pub fn force(&self, ctx: &mut C::Context)
[src]
Forces the variable to re-compute no matter its current dirty status.
pub fn check(&self, ctx: &mut C::Context)
[src]
If changes to upstream variables have made this variable dirty, re-compute it. Otherwise, do nothing.
Trait Implementations
impl<C: ComputedValue<Context = ()>> Debug for ComputedVar<C> where
C::Value: Debug,
[src]
C::Value: Debug,
impl<C: ComputedValue<Context = ()>> Variable for ComputedVar<C>
[src]
type Value = C::Value
The type of this variable.
fn node(&self) -> &Node
[src]
fn get(&self) -> Ref<C::Value>
[src]
fn get_non_reactive(&self) -> Ref<C::Value>
[src]
fn get_copy(&self) -> Self::Value where
Self::Value: Copy,
[src]
Self::Value: Copy,
fn map<T, F>(self, func: F) -> ComputedVar<FunctionMapped<Self, T, F>> where
F: FnMut(&Self::Value) -> T,
[src]
F: FnMut(&Self::Value) -> T,
fn map_mutate<T, F>(
self,
initial: T,
func: F
) -> ComputedVar<MutatorMapped<Self, T, F>> where
F: FnMut(&Self::Value, &mut T),
[src]
self,
initial: T,
func: F
) -> ComputedVar<MutatorMapped<Self, T, F>> where
F: FnMut(&Self::Value, &mut T),
fn with_label(self, label: impl Display) -> Self
[src]
Auto Trait Implementations
impl<C> !RefUnwindSafe for ComputedVar<C>
impl<C> !Send for ComputedVar<C>
impl<C> !Sync for ComputedVar<C>
impl<C> Unpin for ComputedVar<C> where
C: Unpin,
C: Unpin,
impl<C> UnwindSafe for ComputedVar<C> where
C: UnwindSafe,
C: 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<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>,