Expand description
§Watcher Management
This module provides the infrastructure for managing reactive value watchers, including metadata handling and notification systems.
§When watcher would be called?
Watchers are called when the value may have changed.
This means that even if the new value is equal to the old value, watchers may will still be called.
§Why not only when value actually changed?
Since we does not require Eq or PartialEq bounds on the watched values, so we cannot determine
whether the value actually changed or not.
§So if upstream user calls notify, my watcher will always be called?
The answer is: Maybe yes, maybe no.
We preserve the freedom to discard notifications in certain scenarios, as a performance optimization.
Also, you can use nami::distinct to create a distinct signal that only notifies when the value changes manually.
Structs§
- Context
- Context passed to watchers containing the value and associated metadata.
- Metadata
- A type-erased container for metadata that can be associated with computation results.
- OnDrop
- A utility struct that runs a cleanup function when dropped.
- Watcher
Manager - Manages a collection of watchers for a specific computation type.
- Watcher
Manager Guard - A guard that ensures a watcher is unregistered when dropped.
Traits§
- Watcher
Guard - A guard that ensures proper cleanup of watchers when dropped.
Type Aliases§
- BoxWatcher
Guard - Type alias for a boxed watcher guard.
- Watcher
- Type alias for a reference-counted watcher function.