[−][src]Trait reax::Variable
A trait implemented by any wrapped data which reax can manage.
Associated Types
type Value
The type of this variable.
Required methods
fn node(&self) -> &Node
Returns a handle to this variable's node in the reax runtime's dependency graph.
fn get(&self) -> Ref<Self::Value>
Returns the value of this variable.
Note that right now this trait assumes that the data is stored behind a
RefCell
. The source of interior mutability can be made more generic
once GATs are stabilized.
fn get_non_reactive(&self) -> Ref<Self::Value>
Returns the value of this variable without alerting the reax runtime
that the variable is used in the current context. See also
get
.
Provided methods
fn get_copy(&self) -> Self::Value where
Self::Value: Copy,
Self::Value: Copy,
Returns the value of this variable by copy where possible. See also
get
.
fn map<T, F>(self, func: F) -> ComputedVar<FunctionMapped<Self, T, F>> where
F: FnMut(&Self::Value) -> T,
F: FnMut(&Self::Value) -> T,
Create a new ComputedVar
which depends only on this variable. The
value of the returned cell is lazily computed by the given function.
That is, the function will not be executed until someone retrieves the
value of the cell. This can be used similarly to
EagerCompute::watch
if the
resulting cell is checked frequently. See also
ComputedVar::new
.
Note that variables should usually be borrowed or Rc::clone
ed before
being passed to this function (e.g. (&variable).map(...)
).
fn map_mutate<T, F>(
self,
initial: T,
func: F
) -> ComputedVar<MutatorMapped<Self, T, F>> where
F: FnMut(&Self::Value, &mut T),
self,
initial: T,
func: F
) -> ComputedVar<MutatorMapped<Self, T, F>> where
F: FnMut(&Self::Value, &mut T),
Create a new ComputedVar
which depends only on this variable. The
value of the returned cell is lazily updated by the given function. That
is, the function will not be executed until someone retrieves the value
of the cell. This can be used similarly to
EagerCompute::watch
if the
resulting cell is checked frequently. See also
ComputedVar::new_mutate
.
Note that variables should usually be borrowed or Rc::clone
ed before
being passed to this function (e.g. (&variable).map_mutate(...)
).
fn with_label(self, label: impl Display) -> Self
Provides the runtime with a variable name to use in debug outputs. This does nothing in release builds.
Implementations on Foreign Types
impl<'r, T> Variable for &'r T where
T: Variable,
[src]
T: Variable,
type Value = T::Value
fn node(&self) -> &Node
[src]
fn get(&self) -> Ref<Self::Value>
[src]
fn get_non_reactive<'a>(&self) -> Ref<Self::Value>
[src]
impl<T> Variable for Rc<T> where
T: Variable,
[src]
T: Variable,
type Value = T::Value
fn node(&self) -> &Node
[src]
fn get(&self) -> Ref<Self::Value>
[src]
fn get_non_reactive<'a>(&self) -> Ref<Self::Value>
[src]
impl<T> Variable for Box<T> where
T: Variable,
[src]
T: Variable,