Skip to main content

HashSetSubscription

Struct HashSetSubscription 

Source
pub struct HashSetSubscription<T, Codec = Default> { /* private fields */ }
Available on crate feature 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>
where T: RemoteSend + Eq + Hash + Clone, Codec: Codec,

Source

pub fn is_incremental(&self) -> bool

Returns whether the subscription is incremental.

Source

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.

Source

pub fn is_done(&self) -> bool

Returns whether the observed hash set has indicated that no further change events will occur.

Source

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.

Source

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>
where T: RemoteSend + Eq + Hash + Clone + Sync, Codec: Codec,

Source

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ยง

Sourceยง

impl<T: Debug, Codec: Debug> Debug for HashSetSubscription<T, Codec>

Sourceยง

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Sourceยง

impl<'de, T, Codec> Deserialize<'de> for HashSetSubscription<T, Codec>
where T: RemoteSend + Eq + Hash, Codec: Codec,

Sourceยง

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Sourceยง

impl<T, Codec> Serialize for HashSetSubscription<T, Codec>
where T: RemoteSend + Eq + Hash, Codec: Codec,

Sourceยง

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementationsยง

ยง

impl<T, Codec = Postbag> !Freeze for HashSetSubscription<T, Codec>

ยง

impl<T, Codec = Postbag> !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: Sync + Send,

ยง

impl<T, Codec> Unpin for HashSetSubscription<T, Codec>
where T: Unpin,

ยง

impl<T, Codec> UnsafeUnpin for HashSetSubscription<T, Codec>

ยง

impl<T, Codec = Postbag> !UnwindSafe for HashSetSubscription<T, Codec>

Blanket Implementationsยง

Sourceยง

impl<T> Any for T
where T: 'static + ?Sized,

Sourceยง

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Sourceยง

impl<T> Borrow<T> for T
where T: ?Sized,

Sourceยง

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Sourceยง

impl<T> BorrowMut<T> for T
where T: ?Sized,

Sourceยง

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Sourceยง

impl<T> From<T> for T

Sourceยง

fn from(t: T) -> T

Returns the argument unchanged.

Sourceยง

impl<T> Instrument for T

Sourceยง

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Sourceยง

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Sourceยง

impl<T, U> Into<U> for T
where U: From<T>,

Sourceยง

fn into(self) -> U

Calls U::from(self).

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

Sourceยง

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Sourceยง

type Error = Infallible

The type returned in the event of a conversion error.
Sourceยง

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Sourceยง

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Sourceยง

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Sourceยง

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Sourceยง

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Sourceยง

fn vzip(self) -> V

Sourceยง

impl<T> WithSubscriber for T

Sourceยง

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
Sourceยง

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Sourceยง

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Sourceยง

impl<T> RemoteSend for T
where T: Send + Serialize + DeserializeOwned + 'static,