pub struct UnboundedReceiver<T> { /* private fields */ }
Expand description
The Receiver-Half of an unbounded Queue
Implementations
sourceimpl<T> UnboundedReceiver<T>
impl<T> UnboundedReceiver<T>
sourcepub fn is_closed(&self) -> bool
pub fn is_closed(&self) -> bool
Checks if the Queue has been closed by the Producer
Example
let (rx, tx) = unbounded::queue::<usize>();
// Dropping the Producer and therefore closing 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
Successful Dequeue
let (mut rx, mut tx) = unbounded::queue::<usize>();
tx.enqueue(13).unwrap();
assert_eq!(Ok(13), rx.try_dequeue());
Dequeue on empty Queue
let (mut rx, mut tx) = unbounded::queue::<usize>();
assert_eq!(Err(DequeueError::Empty), rx.try_dequeue());
Trait Implementations
sourceimpl<T> Debug for UnboundedReceiver<T>
impl<T> Debug for UnboundedReceiver<T>
sourceimpl<T> Drop for UnboundedReceiver<T>
impl<T> Drop for UnboundedReceiver<T>
impl<T> Send for UnboundedReceiver<T>
impl<T> Sync for UnboundedReceiver<T>
Auto Trait Implementations
impl<T> !RefUnwindSafe for UnboundedReceiver<T>
impl<T> Unpin for UnboundedReceiver<T>
impl<T> !UnwindSafe for UnboundedReceiver<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