pub struct Sender<T: Clone> { /* private fields */ }Expand description
Producer side. Cheaply cloneable.
Implementations§
Source§impl<T: Clone> Sender<T>
impl<T: Clone> Sender<T>
Sourcepub fn send(&self, value: T) -> Result<usize, SendError<T>>
pub fn send(&self, value: T) -> Result<usize, SendError<T>>
Send a value to every active receiver. Returns the subscriber
count at the time of the send. Returns SendError(value) if
no receivers are listening.
Sourcepub fn subscribe(&self) -> Receiver<T>
pub fn subscribe(&self) -> Receiver<T>
Build a fresh receiver subscribed at the current end of the stream. Messages broadcast BEFORE this call are not delivered to the new receiver.
Sourcepub fn receiver_count(&self) -> usize
pub fn receiver_count(&self) -> usize
Returns the number of currently-active receivers.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Sender<T>
impl<T> RefUnwindSafe for Sender<T>
impl<T> Send for Sender<T>
impl<T> Sync for Sender<T>
impl<T> Unpin for Sender<T>
impl<T> UnsafeUnpin for Sender<T>
impl<T> UnwindSafe for Sender<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