Struct remoc_obs::hash_set::HashSetSubscription
source · [−]pub struct HashSetSubscription<T, Codec = Default> { /* private fields */ }
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
sourceimpl<T, Codec> HashSetSubscription<T, Codec> where
T: RemoteSend + Eq + Hash + Clone,
Codec: Codec,
impl<T, Codec> HashSetSubscription<T, Codec> where
T: RemoteSend + Eq + Hash + Clone,
Codec: 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.
sourceimpl<T, Codec> HashSetSubscription<T, Codec> where
T: RemoteSend + Eq + Hash + Clone + Sync,
Codec: Codec,
impl<T, Codec> HashSetSubscription<T, Codec> where
T: RemoteSend + Eq + Hash + Clone + Sync,
Codec: 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.
Trait Implementations
sourceimpl<T: Debug, Codec: Debug> Debug for HashSetSubscription<T, Codec>
impl<T: Debug, Codec: Debug> Debug for HashSetSubscription<T, Codec>
sourceimpl<'de, T, Codec> Deserialize<'de> for HashSetSubscription<T, Codec> where
T: RemoteSend + Eq + Hash,
Codec: Codec,
impl<'de, T, Codec> Deserialize<'de> for HashSetSubscription<T, Codec> where
T: RemoteSend + Eq + Hash,
Codec: Codec,
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl<T, Codec> Serialize for HashSetSubscription<T, Codec> where
T: RemoteSend + Eq + Hash,
Codec: Codec,
impl<T, Codec> Serialize for HashSetSubscription<T, Codec> where
T: RemoteSend + Eq + Hash,
Codec: Codec,
Auto Trait Implementations
impl<T, Codec = Default> !RefUnwindSafe for HashSetSubscription<T, Codec>
impl<T, Codec> Send for HashSetSubscription<T, Codec> where
Codec: Send,
T: Send,
impl<T, Codec> Sync for HashSetSubscription<T, Codec> where
Codec: Sync,
T: Send + Sync,
impl<T, Codec> Unpin for HashSetSubscription<T, Codec> where
T: Unpin,
impl<T, Codec = Default> !UnwindSafe for HashSetSubscription<T, Codec>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
pub fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more