[][src]Struct reax::computed::ComputedVar

#[must_use]pub struct ComputedVar<C> { /* fields omitted */ }

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]

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]

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]

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]

impl<C: ComputedValue<Context = ()>> Variable for ComputedVar<C>[src]

type Value = C::Value

The type of this variable.

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

impl<C> UnwindSafe for ComputedVar<C> where
    C: UnwindSafe

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<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.