pub struct RawSubscription { /* private fields */ }
Expand description
A Subscription is a feed of notifications from the server, identified by a local ID.
This type is mostly a wrapper around broadcast::Receiver
, and exposes
the same methods.
Implementations§
Source§impl RawSubscription
impl RawSubscription
Sourcepub fn blocking_recv(&mut self) -> Result<Box<RawValue>, RecvError>
pub fn blocking_recv(&mut self) -> Result<Box<RawValue>, RecvError>
Wrapper for blocking_recv
. Block the current thread until a message
is available.
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true
if the broadcast channel is empty (i.e. there are
currently no notifications to receive).
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns the number of messages in the broadcast channel that this receiver has yet to receive.
Sourcepub async fn recv(&mut self) -> Result<Box<RawValue>, RecvError>
pub async fn recv(&mut self) -> Result<Box<RawValue>, RecvError>
Wrapper for recv
. Await an item from the channel.
Sourcepub fn resubscribe(&self) -> Self
pub fn resubscribe(&self) -> Self
Wrapper for resubscribe
. Create a new Subscription, starting from
the current tail element.
Sourcepub fn same_channel(&self, other: &Self) -> bool
pub fn same_channel(&self, other: &Self) -> bool
Wrapper for same_channel
. Returns true
if the two subscriptions
share the same broadcast channel.
Sourcepub fn try_recv(&mut self) -> Result<Box<RawValue>, TryRecvError>
pub fn try_recv(&mut self) -> Result<Box<RawValue>, TryRecvError>
Wrapper for try_recv
. Attempt to receive a message from the channel
without awaiting.
Sourcepub fn into_stream(self) -> BroadcastStream<Box<RawValue>>
pub fn into_stream(self) -> BroadcastStream<Box<RawValue>>
Convert the subscription into a stream.
Sourcepub fn into_typed<T>(self) -> Subscription<T>
pub fn into_typed<T>(self) -> Subscription<T>
Convert into a typed subscription.