Rx means “reactive value” (or “reactive X”). It is a wrapper for a value which changes,
and these changes trigger dependencies to re-run and change themselves.
Because of Rust’s borrowing rules, you can’t just have
Rx values change arbitrarily,
because then references will be invalidated. Instead, when an
Rx is updated, this update is delayed until there are no mutable references.
Furthermore, you cannot just get a mutable reference to an
Rx value, you must set it to an entirely new value.
The way it works is, there is an RxDAG which stores the entire dependency graph, and you can only get a reference to an
from a shared reference to the graph. The
Rxs update when you call RxDAG::recompute, which requires a mutable reference.
Rx closures must have a specific lifetime, because they may be recomputed.
This lifetime is annotated
'c and the same lifetime is for every closure in an RxDAG.
value directly, instead you use an associated function like [RxDAG::run_rx] to access it in a closure
which can re-run whenever the dependency changes. You can create new
Rxs from old ones.
The centralized structure which contains all your interconnected reactive values.