Struct embassy_sync::pubsub::subscriber::Subscriber
source · pub struct Subscriber<'a, M: RawMutex, T: Clone, const CAP: usize, const SUBS: usize, const PUBS: usize>(/* private fields */);
Expand description
A subscriber that holds a generic reference to the channel
Methods from Deref<Target = Sub<'a, PubSubChannel<M, T, CAP, SUBS, PUBS>, 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.
Trait Implementations§
Auto Trait Implementations§
impl<'a, M, T, const CAP: usize, const SUBS: usize, const PUBS: usize> !RefUnwindSafe for Subscriber<'a, M, T, CAP, SUBS, PUBS>
impl<'a, M, T, const CAP: usize, const SUBS: usize, const PUBS: usize> Send for Subscriber<'a, M, T, CAP, SUBS, PUBS>where M: Sync, T: Send,
impl<'a, M, T, const CAP: usize, const SUBS: usize, const PUBS: usize> Sync for Subscriber<'a, M, T, CAP, SUBS, PUBS>where M: Sync, T: Send + Sync,
impl<'a, M, T, const CAP: usize, const SUBS: usize, const PUBS: usize> Unpin for Subscriber<'a, M, T, CAP, SUBS, PUBS>
impl<'a, M, T, const CAP: usize, const SUBS: usize, const PUBS: usize> !UnwindSafe for Subscriber<'a, M, T, CAP, SUBS, PUBS>
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