[][src]Trait reax::computed::ComputedValue

pub trait ComputedValue {
    type Value;
    type Context;
    fn update(&mut self, ctx: &mut Self::Context, comp: &ComputationHandle);
fn read(&self) -> &Self::Value; }

A trait implemented by any item which can be wrapped in a ComputedVar.

Associated Types

type Value

The value visible within the ComputedVar.

type Context

The context used by the update function.

Loading content...

Required methods

fn update(&mut self, ctx: &mut Self::Context, comp: &ComputationHandle)

Recompute the value of this item.

fn read(&self) -> &Self::Value

Cheaply get a reference to the value of this item. This function is free to panic if update has never been called.

Loading content...

Implementations on Foreign Types

impl<'a, T, C> ComputedValue for Box<dyn ComputedValue<Value = T, Context = C> + 'a>[src]

type Value = T

type Context = C

Loading content...

Implementors

impl<T, F, C> ComputedValue for FunctionComputed<T, F, C> where
    F: FnMut(&mut C) -> T, 
[src]

type Value = T

type Context = C

impl<T, F, C> ComputedValue for MutatorComputed<T, F, C> where
    F: FnMut(&mut T, &mut C), 
[src]

type Value = T

type Context = C

impl<V, T, F> ComputedValue for FunctionMapped<V, T, F> where
    V: Variable,
    F: FnMut(&V::Value) -> T, 
[src]

type Value = T

type Context = ()

impl<V, T, F> ComputedValue for MutatorMapped<V, T, F> where
    V: Variable,
    F: FnMut(&V::Value, &mut T), 
[src]

type Value = T

type Context = ()

Loading content...