pub struct WatcherRegistry { /* private fields */ }Expand description
Registry of state watchers, evaluated after each mutation cycle.
Implementations§
Source§impl WatcherRegistry
impl WatcherRegistry
Sourcepub fn observed_keys(&self) -> &HashSet<String>
pub fn observed_keys(&self) -> &HashSet<String>
The set of state keys observed by at least one watcher.
Used by the processor to scope State::snapshot_values() so only
relevant keys are captured before mutations.
Sourcepub fn evaluate(
&self,
diffs: &[(String, Value, Value)],
state: &State,
) -> (Vec<BoxFuture<()>>, Vec<BoxFuture<()>>)
pub fn evaluate( &self, diffs: &[(String, Value, Value)], state: &State, ) -> (Vec<BoxFuture<()>>, Vec<BoxFuture<()>>)
Evaluate all watchers against the given state diffs.
diffs contains (key, old_value, new_value) tuples produced by
State::diff_values(). For each diff entry, every watcher whose key
matches and whose predicate fires will have its action invoked.
Returns (blocking_futures, concurrent_futures).
Sourcepub fn evaluate_mutations(
&self,
mutations: &[StateMutation],
state: &State,
) -> (Vec<BoxFuture<()>>, Vec<BoxFuture<()>>)
pub fn evaluate_mutations( &self, mutations: &[StateMutation], state: &State, ) -> (Vec<BoxFuture<()>>, Vec<BoxFuture<()>>)
Evaluate watchers from a batch of recorded state mutations.
Multiple mutations for the same key are collapsed into the same net
(old, new) diff shape used by Self::evaluate, preserving watcher
behavior while avoiding a pre-turn state snapshot.