Enum wnf::SeenChangeStamp

source ·
pub enum SeenChangeStamp {
    None,
    Current,
    Value(ChangeStamp),
}
Available on crate feature 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§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
Feeds this value into the given Hasher. Read more
Feeds a slice of this type into the given Hasher. Read more
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more