pub struct RawSubscription {
pub rx: Receiver<Box<RawValue>>,
pub local_id: B256,
}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.
Fields§
§rx: Receiver<Box<RawValue>>The channel via which notifications are received.
local_id: B256The local ID of the subscription.
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.
Trait Implementations§
Source§impl Debug for RawSubscription
impl Debug for RawSubscription
Source§impl<T> From<RawSubscription> for Subscription<T>
impl<T> From<RawSubscription> for Subscription<T>
Source§fn from(inner: RawSubscription) -> Self
fn from(inner: RawSubscription) -> Self
Auto Trait Implementations§
impl Freeze for RawSubscription
impl RefUnwindSafe for RawSubscription
impl Send for RawSubscription
impl Sync for RawSubscription
impl Unpin for RawSubscription
impl UnsafeUnpin for RawSubscription
impl UnwindSafe for RawSubscription
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
Source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
Source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 48 bytes