pub struct Receiver<T> { /* private fields */ }Expand description
The receiving side of the spsc queue.
Implementations§
Source§impl<T> Receiver<T>
impl<T> Receiver<T>
Sourcepub fn try_recv(&mut self) -> Result<T, TryRecvError>
pub fn try_recv(&mut self) -> Result<T, TryRecvError>
Retrieve the next available element from the queue without blocking.
Returns TryRecvError::Empty if the queue is currently empty,
or TryRecvError::Disconnected if the Sender has been dropped and
no further items can arrive.
Sourcepub fn capacity(&self) -> usize
pub fn capacity(&self) -> usize
Returns the total number of items that the queue can hold at most.
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns the number of items in the queue.
§WARNING
This length is only a best-effort estimate. It is computed from relaxed atomic and is NOT a linearizable value. It may be temporarily incorrect (including over/under-counting) due to reordering and visibility delays across threads.
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true if the queue is empty.
§WARNING
This length is only a best-effort estimate. It is computed from relaxed atomic and is NOT a linearizable value. It may be temporarily incorrect (including over/under-counting) due to reordering and visibility delays across threads.