pub struct Sub<'a, PSB: PubSubBehavior<T> + ?Sized, T: Clone> { /* private fields */ }
Expand description
A subscriber to a channel
Implementations§
Source§impl<'a, PSB: PubSubBehavior<T> + ?Sized, T: Clone> Sub<'a, PSB, T>
impl<'a, PSB: PubSubBehavior<T> + ?Sized, T: Clone> Sub<'a, PSB, T>
Sourcepub fn next_message<'s>(&'s mut self) -> SubscriberWaitFuture<'s, 'a, PSB, T> ⓘ
pub fn next_message<'s>(&'s mut self) -> SubscriberWaitFuture<'s, 'a, PSB, T> ⓘ
Wait for a published message
Sourcepub async fn next_message_pure(&mut self) -> T
pub async fn next_message_pure(&mut self) -> T
Wait for a published message (ignoring lag results)
Sourcepub fn try_next_message(&mut self) -> Option<WaitResult<T>>
pub fn try_next_message(&mut self) -> Option<WaitResult<T>>
Try to see if there’s a published message we haven’t received yet.
This function does not peek. The message is received if there is one.
Sourcepub fn try_next_message_pure(&mut self) -> Option<T>
pub fn try_next_message_pure(&mut self) -> Option<T>
Try to see if there’s a published message we haven’t received yet (ignoring lag results).
This function does not peek. The message is received if there is one.
Sourcepub fn available(&self) -> u64
pub fn available(&self) -> u64
The amount of messages this subscriber hasn’t received yet. This is like Self::len but specifically for this subscriber.
Sourcepub fn free_capacity(&self) -> usize
pub fn free_capacity(&self) -> usize
Returns the free capacity of the channel.
This is equivalent to capacity() - len()
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns the number of elements currently in the channel. See Self::available for how many messages are available for this subscriber.
Trait Implementations§
Source§impl<'a, PSB: Debug + PubSubBehavior<T> + ?Sized, T: Debug + Clone> Debug for Sub<'a, PSB, T>
impl<'a, PSB: Debug + PubSubBehavior<T> + ?Sized, T: Debug + Clone> Debug for Sub<'a, PSB, T>
Source§impl<'a, PSB: PubSubBehavior<T> + ?Sized, T: Clone> Stream for Sub<'a, PSB, T>
Warning: The stream implementation ignores lag results and returns all messages.
This might miss some messages without you knowing it.
impl<'a, PSB: PubSubBehavior<T> + ?Sized, T: Clone> Stream for Sub<'a, PSB, T>
Warning: The stream implementation ignores lag results and returns all messages. This might miss some messages without you knowing it.