Module watch
Expand description
A state distribution channel. The internal state can be borrowed or cloned, but receivers do not observe every value.
When the channel is created, the receiver will immediately observe T::default()
. Cloned receivers will immediately observe the latest stored value.
Senders can mutably borrow the contained value (which notifies receivers on release). Receivers can immutably borrow the contained value.
Structs§
- Receiver
- The receiver half of a watch channel. Can recieve state updates with the postage::Sink trait.
- Ref
- An immutable reference to the value contained in the channel.
- RefMut
- A mutable reference to the value contained in the channel. Receivers are notified when the borrow is released.
- Sender
- The sender half of a watch channel. The stored value can be updated with the postage::Sink trait.
Functions§
- channel
- Constructs a new watch channel pair, filled with
T::default()
. - channel_
with - Constructs a new watch channel pair, filled with the provided value
- channel_
with_ option - Constructs a pair of channel endpoints that store Option