pub struct KeyReceiver<K: Key, V: Value> { /* private fields */ }Expand description
A receiver for messages for a specific key.
Created via KeySender::subscribe.
Implementations§
Source§impl<K: Key, V: Value> KeyReceiver<K, V>
impl<K: Key, V: Value> KeyReceiver<K, V>
Sourcepub async fn recv(&mut self) -> Result<V, RecvError>
pub async fn recv(&mut self) -> Result<V, RecvError>
Receive the next message for this key, waiting asynchronously. See, tokio::sync::broadcast::Receiver::recv for more details.
Sourcepub async fn try_recv(&mut self) -> Result<V, TryRecvError>
pub async fn try_recv(&mut self) -> Result<V, TryRecvError>
Try to receive the next message for this key without waiting.. See, tokio::sync::broadcast::Receiver::try_recv for more details.
Sourcepub fn blocking_recv(&mut self) -> Result<V, RecvError>
pub fn blocking_recv(&mut self) -> Result<V, RecvError>
Receive the next message for this key, blocking the current thread. Only use in synchronous contexts. See, tokio::sync::broadcast::Receiver::blocking_recv for more details.
Sourcepub fn to_async_stream(self) -> impl Stream<Item = Result<V, RecvError>>
pub fn to_async_stream(self) -> impl Stream<Item = Result<V, RecvError>>
Consume this receiver and convert it into a stream of messages for this key.
Trait Implementations§
Auto Trait Implementations§
impl<K, V> Freeze for KeyReceiver<K, V>where
K: Freeze,
impl<K, V> RefUnwindSafe for KeyReceiver<K, V>where
K: RefUnwindSafe,
impl<K, V> Send for KeyReceiver<K, V>
impl<K, V> Sync for KeyReceiver<K, V>
impl<K, V> Unpin for KeyReceiver<K, V>where
K: Unpin,
impl<K, V> UnsafeUnpin for KeyReceiver<K, V>where
K: UnsafeUnpin,
impl<K, V> UnwindSafe for KeyReceiver<K, V>where
K: UnwindSafe,
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