pub struct BlockingSubscriber { /* private fields */ }
Expand description
A client that has entered pub/sub mode.
Once clients subscribe to a channel, they may only perform pub/sub related
commands. The BlockingClient
type is transitioned to a
BlockingSubscriber
type in order to prevent non-pub/sub methods from being
called.
Implementations§
Source§impl BlockingSubscriber
impl BlockingSubscriber
Sourcepub fn get_subscribed(&self) -> &[String]
pub fn get_subscribed(&self) -> &[String]
Returns the set of channels currently subscribed to.
Sourcepub fn next_message(&mut self) -> Result<Option<Message>>
pub fn next_message(&mut self) -> Result<Option<Message>>
Receive the next message published on a subscribed channel, waiting if necessary.
None
indicates the subscription has been terminated.
Sourcepub fn into_iter(self) -> impl Iterator<Item = Result<Message>>
pub fn into_iter(self) -> impl Iterator<Item = Result<Message>>
Convert the subscriber into an Iterator
yielding new messages published
on subscribed channels.
Sourcepub fn subscribe(&mut self, channels: &[String]) -> Result<()>
pub fn subscribe(&mut self, channels: &[String]) -> Result<()>
Subscribe to a list of new channels
Sourcepub fn unsubscribe(&mut self, channels: &[String]) -> Result<()>
pub fn unsubscribe(&mut self, channels: &[String]) -> Result<()>
Unsubscribe to a list of new channels
Auto Trait Implementations§
impl !Freeze for BlockingSubscriber
impl !RefUnwindSafe for BlockingSubscriber
impl Send for BlockingSubscriber
impl Sync for BlockingSubscriber
impl Unpin for BlockingSubscriber
impl !UnwindSafe for BlockingSubscriber
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