Struct batch_channel::Receiver
source · pub struct Receiver<T> { /* private fields */ }Expand description
The receiving half of a channel.
Implementations§
source§impl<T> Receiver<T>
impl<T> Receiver<T>
sourcepub fn recv_batch(
&self,
element_limit: usize
) -> impl Future<Output = Vec<T>> + '_
pub fn recv_batch( &self, element_limit: usize ) -> impl Future<Output = Vec<T>> + '_
sourcepub fn recv_vec<'a>(
&'a self,
element_limit: usize,
vec: &'a mut Vec<T>
) -> impl Future<Output = ()> + 'a
pub fn recv_vec<'a>( &'a self, element_limit: usize, vec: &'a mut Vec<T> ) -> impl Future<Output = ()> + 'a
Wait for up to element_limit values from the channel and
store them in vec.
vec should be empty when passed in. Nevertheless, recv_vec
will clear it before adding values. The intent of recv_vec
is that batches can be repeatedly read by workers without new
allocations.
It’s not required, but vec’s capacity should be greater than
or equal to element_limit to avoid reallocation.
Trait Implementations§
Auto Trait Implementations§
impl<T> RefUnwindSafe for Receiver<T>
impl<T> Send for Receiver<T>where T: Send,
impl<T> Sync for Receiver<T>where T: Send,
impl<T> Unpin for Receiver<T>
impl<T> UnwindSafe for Receiver<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