pub struct Subscriber<T> { /* private fields */ }
Expand description
Low-level MQTT message subscriber with manual unsubscription
Implementations§
Source§impl<T> Subscriber<T>
impl<T> Subscriber<T>
Sourcepub fn new(
receiver: Receiver<(Arc<TopicMatch>, Arc<T>)>,
unsubscribe_tx: Sender<SubscriptionId>,
id: SubscriptionId,
) -> Subscriber<T>
pub fn new( receiver: Receiver<(Arc<TopicMatch>, Arc<T>)>, unsubscribe_tx: Sender<SubscriptionId>, id: SubscriptionId, ) -> Subscriber<T>
Creates a new subscriber with the given channels.
Sourcepub async fn recv(&mut self) -> Option<(Arc<TopicMatch>, Arc<T>)>
pub async fn recv(&mut self) -> Option<(Arc<TopicMatch>, Arc<T>)>
Receives the next message from subscription.
Sourcepub async fn unsubscribe(self) -> Result<(), SendError<SubscriptionId>>
pub async fn unsubscribe(self) -> Result<(), SendError<SubscriptionId>>
Unsubscribes from the topic pattern.
Sourcepub fn unsubscribe_immediate(
&mut self,
) -> Result<(), TrySendError<SubscriptionId>>
pub fn unsubscribe_immediate( &mut self, ) -> Result<(), TrySendError<SubscriptionId>>
Immediately unsubscribes without waiting.
Trait Implementations§
Source§impl<T> Debug for Subscriber<T>where
T: Debug,
impl<T> Debug for Subscriber<T>where
T: Debug,
Auto Trait Implementations§
impl<T> Freeze for Subscriber<T>
impl<T> RefUnwindSafe for Subscriber<T>
impl<T> Send for Subscriber<T>
impl<T> Sync for Subscriber<T>
impl<T> Unpin for Subscriber<T>
impl<T> UnwindSafe for Subscriber<T>
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