[][src]Struct mini_redis::client::Subscriber

pub struct Subscriber { /* fields omitted */ }

A client that has entered pub/sub mode.

Once clients subscribe to a channel, they may only perform pub/sub related commands. The Client type is transitioned to a Subscriber type in order to prevent non-pub/sub methods from being called.

Implementations

impl Subscriber[src]

pub fn get_subscribed(&self) -> &[String][src]

Returns the set of channels currently subscribed to.

pub async fn next_message<'_>(&'_ mut self) -> Result<Option<Message>>[src]

Receive the next message published on a subscribed channel, waiting if necessary.

None indicates the subscription has been terminated.

pub fn into_stream(self) -> impl Stream<Item = Result<Message>>[src]

Convert the subscriber into a Stream yielding new messages published on subscribed channels.

Subscriber does not implement stream itself as doing so with safe code is non trivial. The usage of async/await would require a manual Stream implementation to use unsafe code. Instead, a conversion function is provided and the returned stream is implemented with the help of the async-stream crate.

pub async fn subscribe<'_, '_>(
    &'_ mut self,
    channels: &'_ [String]
) -> Result<()>
[src]

Subscribe to a list of new channels

pub async fn unsubscribe<'_, '_>(
    &'_ mut self,
    channels: &'_ [String]
) -> Result<()>
[src]

Unsubscribe to a list of new channels

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> WithSubscriber for T[src]