pub struct Subscription {
pub channel: String,
event_rx: Receiver<SubscriptionEvent>,
}Expand description
Handle for receiving events from a subscribed channel; drop to stop receiving.
Fields§
§channel: String§event_rx: Receiver<SubscriptionEvent>Implementations§
Source§impl Subscription
impl Subscription
pub(crate) fn new( channel: String, event_rx: Receiver<SubscriptionEvent>, ) -> Self
Sourcepub async fn recv(&mut self) -> Option<SubscriptionEvent>
pub async fn recv(&mut self) -> Option<SubscriptionEvent>
Waits for the next subscription event, or returns None when the client drops the sender.
Sourcepub fn try_recv(&mut self) -> Option<SubscriptionEvent>
pub fn try_recv(&mut self) -> Option<SubscriptionEvent>
Returns the next queued event without waiting.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Subscription
impl RefUnwindSafe for Subscription
impl Send for Subscription
impl Sync for Subscription
impl Unpin for Subscription
impl UnsafeUnpin for Subscription
impl UnwindSafe for Subscription
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
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more