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) -> Option<T>
pub fn try_recv(&mut self) -> Option<T>
Retrieve the next available element from the queue. Returns None if the queue is empty.
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.
Trait Implementations§
impl<T: Send> Send for Receiver<T>
impl<T: Send> Sync for Receiver<T>
Auto Trait Implementations§
impl<T> Freeze for Receiver<T>
impl<T> !RefUnwindSafe for Receiver<T>
impl<T> Unpin for Receiver<T>
impl<T> UnsafeUnpin 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