pub struct BoundedReceiver<T> { /* private fields */ }
Expand description
The Receiving-Half for the Queue
Implementations
sourceimpl<T> BoundedReceiver<T>
impl<T> BoundedReceiver<T>
sourcepub fn is_closed(&self) -> bool
pub fn is_closed(&self) -> bool
Checks if the Queue has been closed by the Producer
Note
Even when this indicates that the Queue has been closed, there might still be Items in the Queue left that should first be dequeued by the Consumer before discarding the entire Queue
Example
let (rx, tx) = bounded::queue::<usize>(3);
// Drop the Producer and therefore also close the Queue
drop(tx);
assert_eq!(true, rx.is_closed());
sourcepub fn try_dequeue(&mut self) -> Result<T, DequeueError>
pub fn try_dequeue(&mut self) -> Result<T, DequeueError>
Attempts to Dequeue a single Element from the Queue
Example
There was something to dequeu
// Create a new Queue with the Capacity for 16-Elements
let (mut rx, mut tx) = bounded::queue::<usize>(16);
// Enqueue the Element
tx.try_enqueue(13);
// Dequeue the Element again
assert_eq!(Ok(13), rx.try_dequeue());
The Queue is empty and therefore nothing could be dequeued
// Create a new Queue with the Capacity for 16-Elements
let (mut rx, mut tx) = bounded::queue::<usize>(16);
// Dequeue the Element again
assert_eq!(Err(DequeueError::Empty), rx.try_dequeue());
Trait Implementations
sourceimpl<T> Debug for BoundedReceiver<T>
impl<T> Debug for BoundedReceiver<T>
sourceimpl<T> Drop for BoundedReceiver<T>
impl<T> Drop for BoundedReceiver<T>
impl<T> Send for BoundedReceiver<T>
impl<T> Sync for BoundedReceiver<T>
Auto Trait Implementations
impl<T> !RefUnwindSafe for BoundedReceiver<T>
impl<T> Unpin for BoundedReceiver<T>
impl<T> !UnwindSafe for BoundedReceiver<T>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more