Struct async_nats::Subscription [−][src]
pub struct Subscription { /* fields omitted */ }
Expand description
A subscription to a subject.
Due to async limitations (lack of AsyncDrop
etc…),
please call Subscription::unsubscribe().await
manually
before dropping Subscription
to avoid blocking the
runtime.
Implementations
impl Subscription
[src]
impl Subscription
[src]pub async fn next(&self) -> Option<Message>
[src]
pub async fn next(&self) -> Option<Message>
[src]Gets the next message, or returns None
if the subscription
has been unsubscribed or the connection is closed.
pub async fn drain(&self) -> Result<()>
[src]
pub async fn drain(&self) -> Result<()>
[src]Stops listening for new messages, but the remaining queued messages can still be received.
pub async fn unsubscribe(&self) -> Result<()>
[src]
pub async fn unsubscribe(&self) -> Result<()>
[src]Stops listening for new messages and discards the remaining queued
messages. This should always be called before dropping
async_nats::Subscription
to avoid blocking the non-async Drop
implementation.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Subscription
impl Send for Subscription
impl Sync for Subscription
impl Unpin for Subscription
impl !UnwindSafe for Subscription
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> Same<T> for T
impl<T> Same<T> for T
type Output = T
type Output = T
Should always be Self
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,