pub struct HashSetSubscription<T, Codec = Default> { /* private fields */ }robs only.Expand description
Observable hash set subscription.
This can be sent to a remote endpoint via a remote channel. Then, on the remote endpoint, mirror can be used to build and keep up-to-date a mirror of the observed hash set.
The event stream can also be processed event-wise using recv. If the subscription is not incremental take_initial must be called before the first call to recv.
Implementationsยง
Sourceยงimpl<T, Codec> HashSetSubscription<T, Codec>
impl<T, Codec> HashSetSubscription<T, Codec>
Sourcepub fn is_incremental(&self) -> bool
pub fn is_incremental(&self) -> bool
Returns whether the subscription is incremental.
Sourcepub fn is_complete(&self) -> bool
pub fn is_complete(&self) -> bool
Returns whether the initial value event or stream of events that build up the initial value has completed or take_initial has been called.
Sourcepub fn is_done(&self) -> bool
pub fn is_done(&self) -> bool
Returns whether the observed hash set has indicated that no further change events will occur.
Sourcepub fn take_initial(&mut self) -> Option<HashSet<T>>
pub fn take_initial(&mut self) -> Option<HashSet<T>>
Take the initial value.
This is only possible if the subscription is not incremental
and the initial value has not already been taken.
Otherwise None is returned.
If the subscription is not incremental this must be called before the first call to recv.
Sourcepub async fn recv(&mut self) -> Result<Option<HashSetEvent<T>>, RecvError>
pub async fn recv(&mut self) -> Result<Option<HashSetEvent<T>>, RecvError>
Receives the next change event.
ยงPanics
Panics when the subscription is not incremental and take_initial has not been called.
Sourceยงimpl<T, Codec> HashSetSubscription<T, Codec>
impl<T, Codec> HashSetSubscription<T, Codec>
Sourcepub fn mirror(self, max_size: usize) -> MirroredHashSet<T, Codec>
pub fn mirror(self, max_size: usize) -> MirroredHashSet<T, Codec>
Mirror the hash set that this subscription is observing.
max_size specifies the maximum allowed size of the mirrored collection.
If this size is reached, processing of events is stopped and
RecvError::MaxSizeExceeded is returned.