pub struct TrackedScope { /* private fields */ }Expand description
A reactive observer for a single frame-rebuild pass.
Run the rebuild under track; afterwards any change to a
signal read during that pass sets the dirty flag (is_dirty)
and fires the process-wide frame waker once (coalesced). Re-running track
re-records dependencies from scratch, so a signal read in one pass but not
the next stops dirtying the scope.
Cheap to clone-around by holding the inner Arc; construct one per
long-lived rebuild target (e.g. one per app root / retained component).
Implementations§
Source§impl TrackedScope
impl TrackedScope
Sourcepub fn track<R>(&self, f: impl FnOnce() -> R) -> R
pub fn track<R>(&self, f: impl FnOnce() -> R) -> R
Runs f with this scope installed as the reactive observer.
Dependency tracking is re-recorded from scratch each call: previously
recorded sources are unsubscribed first, the dirty flag is cleared, then
every signal read inside f re-subscribes this scope. Returns whatever
f returns.