Expand description
Generic “latest-snapshot” state cell over tokio::sync::watch.
Single source of truth for the “hold a value, broadcast on
change, let consumers pull snapshots” pattern. Used by
[moonproof_wallet::runtime::WalletRuntime] (over FacadeState)
and [moonproof_runtime::sync::Watcher] (over ContractRuntimeState).
Each consumer composes its own cancel/lifecycle on top — this
primitive only owns the state + change broadcast.
Distinct from crate::events::EventBus, which is a per-event
firehose (broadcast). State cell is “latest value + change
signal” (watch). Pick whichever fits the domain — they don’t
overlap.
Structs§
- State
Cell - Holds the current value of
Tbehind anArc<RwLock>, plus atokio::sync::watchchannel that fires every time the value changes. Cheap to clone — the inner state + sender areArc-shared.