pub struct Sender<T> { /* private fields */ }
Expand description
An async sender end of an mpmc channel. Messages sent on this are received by all receivers connected to it (they are duplicated).
Implementations§
Source§impl<T: Clone> Sender<T>
impl<T: Clone> Sender<T>
Sourcepub fn with_buffer_size(buffer_size: usize) -> Self
pub fn with_buffer_size(buffer_size: usize) -> Self
Construct a sender whose receivers will buffer the given number of messages.
Sourcepub async fn send(&self, payload: T)
pub async fn send(&self, payload: T)
Sends payload
to all receivers that exist at the time of send.
Sending is never an error, even if there are no receivers.
Sourcepub fn new_receiver(&self) -> Receiver<T>
pub fn new_receiver(&self) -> Receiver<T>
Creates a new receiver who will receive a copy of all messages sent after its creation.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Sender<T>
impl<T> !RefUnwindSafe for Sender<T>
impl<T> Send for Sender<T>where
T: Send,
impl<T> Sync for Sender<T>where
T: Send,
impl<T> Unpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)