pub struct SyncReceiver<T> { /* private fields */ }
Expand description
The synchronous receiving half of a channel.
Implementations§
Source§impl<T> SyncReceiver<T>
impl<T> SyncReceiver<T>
Sourcepub fn into_async(self) -> Receiver<T>
pub fn into_async(self) -> Receiver<T>
Converts SyncReceiver
to asynchronous Receiver
.
Sourcepub fn recv_batch(&self, element_limit: usize) -> Vec<T>
pub fn recv_batch(&self, element_limit: usize) -> Vec<T>
Sourcepub fn recv_vec(&self, element_limit: usize, vec: &mut Vec<T>)
pub fn recv_vec(&self, element_limit: usize, vec: &mut Vec<T>)
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§
Source§impl<T> Clone for SyncReceiver<T>
impl<T> Clone for SyncReceiver<T>
Auto Trait Implementations§
impl<T> Freeze for SyncReceiver<T>
impl<T> RefUnwindSafe for SyncReceiver<T>
impl<T> Send for SyncReceiver<T>where
T: Send,
impl<T> Sync for SyncReceiver<T>where
T: Send,
impl<T> !Unpin for SyncReceiver<T>
impl<T> UnwindSafe for SyncReceiver<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