[−][src]Struct mini_redis::client::Subscriber
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]
&'_ mut self,
channels: &'_ [String]
) -> Result<()>
Subscribe to a list of new channels
pub async fn unsubscribe<'_, '_>(
&'_ mut self,
channels: &'_ [String]
) -> Result<()>
[src]
&'_ mut self,
channels: &'_ [String]
) -> Result<()>
Unsubscribe to a list of new channels
Auto Trait Implementations
impl !RefUnwindSafe for Subscriber
impl Send for Subscriber
impl Sync for Subscriber
impl Unpin for Subscriber
impl !UnwindSafe for Subscriber
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Instrument for T
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> WithSubscriber for T
[src]
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
[src]
S: Into<Dispatch>,