Struct batch_channel::BoundedSender
source · pub struct BoundedSender<T> { /* private fields */ }Expand description
The sending half of a bounded channel.
Implementations§
source§impl<T: 'static> BoundedSender<T>
impl<T: 'static> BoundedSender<T>
sourcepub fn send(
&self,
value: T
) -> impl Future<Output = Result<(), SendError<T>>> + '_
pub fn send( &self, value: T ) -> impl Future<Output = Result<(), SendError<T>>> + '_
Send a single value.
Returns SendError if all receivers are dropped.
sourcepub fn send_iter<'a, I>(
&'a self,
values: I
) -> impl Future<Output = Result<(), SendError<()>>> + 'awhere
I: IntoIterator<Item = T> + 'a,
pub fn send_iter<'a, I>( &'a self, values: I ) -> impl Future<Output = Result<(), SendError<()>>> + 'awhere I: IntoIterator<Item = T> + 'a,
Send multiple values.
If all receivers are dropped, SendError is returned and unsent values are dropped.
sourcepub async fn autobatch<F, R>(
self,
capacity: usize,
f: F
) -> Result<R, SendError<()>>where
for<'a> F: FnOnce(&'a mut BoundedBatchSender<T>) -> BoxFuture<'a, Result<R, SendError<()>>>,
pub async fn autobatch<F, R>( self, capacity: usize, f: F ) -> Result<R, SendError<()>>where for<'a> F: FnOnce(&'a mut BoundedBatchSender<T>) -> BoxFuture<'a, Result<R, SendError<()>>>,
Automatically accumulate sends into a buffer of size batch
and send when full.
The callback’s future must be boxed to work around type system limitations in Rust.
sourcepub async fn autobatch_or_cancel<F>(self, capacity: usize, f: F)where
for<'a> F: FnOnce(&'a mut BoundedBatchSender<T>) -> BoxFuture<'a, Result<(), SendError<()>>>,
pub async fn autobatch_or_cancel<F>(self, capacity: usize, f: F)where for<'a> F: FnOnce(&'a mut BoundedBatchSender<T>) -> BoxFuture<'a, Result<(), SendError<()>>>,
Trait Implementations§
source§impl<T> Clone for BoundedSender<T>
impl<T> Clone for BoundedSender<T>
Auto Trait Implementations§
impl<T> RefUnwindSafe for BoundedSender<T>
impl<T> Send for BoundedSender<T>where T: Send,
impl<T> Sync for BoundedSender<T>where T: Send,
impl<T> Unpin for BoundedSender<T>
impl<T> UnwindSafe for BoundedSender<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