Struct batch_channel::Sender
source · pub struct Sender<T> { /* private fields */ }Expand description
The sending half of a channel.
Implementations§
source§impl<T> Sender<T>
impl<T> Sender<T>
sourcepub fn send(&self, value: T) -> Result<(), SendError<T>>
pub fn send(&self, value: T) -> Result<(), SendError<T>>
Send a single value.
Returns SendError if all receivers are dropped.
sourcepub fn send_iter<I>(&self, values: I) -> Result<(), SendError<I>>where
I: IntoIterator<Item = T>,
pub fn send_iter<I>(&self, values: I) -> Result<(), SendError<I>>where I: IntoIterator<Item = T>,
Send multiple values.
If all receivers are dropped, the values are returned in SendError untouched. Either the entire batch is sent or none of it is sent.
sourcepub fn send_vec(&self, values: Vec<T>) -> Result<Vec<T>, SendError<Vec<T>>>
pub fn send_vec(&self, values: Vec<T>) -> Result<Vec<T>, SendError<Vec<T>>>
Drain a Vec into the channel without deallocating it.
This is a convenience method for allocation-free batched
sends. The values vector is drained, and then returned with
the same capacity it had.
sourcepub fn batch(self, capacity: usize) -> BatchSender<T>
pub fn batch(self, capacity: usize) -> BatchSender<T>
Converts this Sender into a BatchSender with the specified capacity.
BatchSender manages a single allocation containing
capacity elements and automatically sends batches as it
fills.
Trait Implementations§
Auto Trait Implementations§
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