Struct mini_telegram::blocking_client::BlockingSubscriber
source · 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