Enum wnf::SeenChangeStamp
source · pub enum SeenChangeStamp {
None,
Current,
Value(ChangeStamp),
}
subscribe
only.Expand description
The change stamp that a state listener has last seen
The OwnedState::subscribe
and BorrowedState::subscribe
methods expect an argument of this type to
indicate what change stamp of the state the listener has last seen. The listener will then only be notified about
updates with a (strictly) larger change stamp, i.e. updates that happen after the one it has last seen.
Variants§
None
Indicates that a listener has not seen any change stamp
When subscribing with this value, the listener will be notified once about the current data of the state (only if any data has been written to the state yet) and then again once about each future state update.
This is most useful for listeners that track the data of the state, e.g. for showing it in a UI, because it eliminates the need for a separate query for the current data before subscribing.
Current
Indicates that a listener has seen the current change stamp
When subscribing with this value, the listener will be notified once about each future state update, but not about the current data of the state.
This is most useful for listeners that treat updates to the state data as events, e.g. for logging, because it ensures that they are only called when an actual update happens.
Value(ChangeStamp)
Indicates that a listener has seen a change stamp with a particular value
When subscribing with this value, the listener will be notified once about each state update whose change stamp is strictly larger than the given change stamp. The earliest possible notification is for the current data of the state (only if any data has been written to the state yet), i.e. it will never be notified about past state updates regardless of the passed value.
This is most useful if you have queried the state data before and are already holding a change stamp.
Trait Implementations§
source§impl Clone for SeenChangeStamp
impl Clone for SeenChangeStamp
source§fn clone(&self) -> SeenChangeStamp
fn clone(&self) -> SeenChangeStamp
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for SeenChangeStamp
impl Debug for SeenChangeStamp
source§impl Default for SeenChangeStamp
impl Default for SeenChangeStamp
source§fn default() -> SeenChangeStamp
fn default() -> SeenChangeStamp
source§impl Hash for SeenChangeStamp
impl Hash for SeenChangeStamp
source§impl PartialEq<SeenChangeStamp> for SeenChangeStamp
impl PartialEq<SeenChangeStamp> for SeenChangeStamp
source§fn eq(&self, other: &SeenChangeStamp) -> bool
fn eq(&self, other: &SeenChangeStamp) -> bool
self
and other
values to be equal, and is used
by ==
.