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.