pub struct KeySender<K: Key, V: Value> { /* private fields */ }Expand description
Handle for sending and subscribing to messages by key.
Created via KeyStream::sender.
Implementations§
Source§impl<K: Key, V: Value> KeySender<K, V>
impl<K: Key, V: Value> KeySender<K, V>
Sourcepub async fn send(&self, key: &K, value: V) -> Result<usize, SendError<V>>
pub async fn send(&self, key: &K, value: V) -> Result<usize, SendError<V>>
Send a value to all receivers subscribed to the given key.
Returns the number of receivers the message was sent to, or 0 if none.
Sourcepub async fn subscribe(&self, key: K) -> KeyReceiver<K, V>
pub async fn subscribe(&self, key: K) -> KeyReceiver<K, V>
Subscribe to messages for the given key.
Returns a KeyReceiver for receiving messages.
Sourcepub async fn key_capacity(&self) -> usize
pub async fn key_capacity(&self) -> usize
Get the current capacity of the keys map.
Trait Implementations§
Auto Trait Implementations§
impl<K, V> !RefUnwindSafe for KeySender<K, V>
impl<K, V> !UnwindSafe for KeySender<K, V>
impl<K, V> Freeze for KeySender<K, V>
impl<K, V> Send for KeySender<K, V>
impl<K, V> Sync for KeySender<K, V>
impl<K, V> Unpin for KeySender<K, V>
impl<K, V> UnsafeUnpin for KeySender<K, V>
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