pub struct Watcher {
pub key: String,
pub predicate: WatchPredicate,
pub action: Arc<dyn Fn(Value, Value, State) -> BoxFuture<()> + Send + Sync>,
pub blocking: bool,
}Expand description
A single state watcher: observes one key, fires an async action when the predicate matches.
Fields§
§key: StringThe state key to observe.
predicate: WatchPredicateThe condition under which this watcher fires.
action: Arc<dyn Fn(Value, Value, State) -> BoxFuture<()> + Send + Sync>Async action receiving (old_value, new_value, state).
blocking: boolIf true, the processor awaits this action sequentially on the control
lane. If false, the processor spawns it concurrently.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Watcher
impl !RefUnwindSafe for Watcher
impl Send for Watcher
impl Sync for Watcher
impl Unpin for Watcher
impl !UnwindSafe for Watcher
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more