Struct nolock::queues::mpsc::jiffy::AsyncReceiver [−][src]
pub struct AsyncReceiver<T> { /* fields omitted */ }
Expand description
This is the asynchronous Version of the Jiffy-Receiver
Implementations
Checks if the current Queue has been closed by the Producer
Note
This does not mean, that there are no more Elements in the Queue currently. It only indicates that there will be no new Elements inserted into the Queue, but there might still be a any number of Elements currently still left in the Queue.
This attempts to dequeue the first Element in the Queue.
This is the same as try_dequeue
on the
normal Jiffy-Queue
pub fn dequeue<'queue>(&'queue mut self) -> DequeueFuture<'queue, T>ⓘNotable traits for DequeueFuture<'queue, T>
impl<'queue, T> Future for DequeueFuture<'queue, T> type Output = Result<T, DequeueError>;
pub fn dequeue<'queue>(&'queue mut self) -> DequeueFuture<'queue, T>ⓘNotable traits for DequeueFuture<'queue, T>
impl<'queue, T> Future for DequeueFuture<'queue, T> type Output = Result<T, DequeueError>;
This is the asynchronous version of the blocking
dequeue
operation on the normal Jiffy-Queue
Behaviour
The Future returned, will either resolve once an item is ready to be
dequeued (Ok
) or the Queue encountered a “fatal” error, like when the other
side closes the Queue (Err
)
Example
async fn demo() { let (mut rx, tx) = jiffy::async_queue::<usize>(); tx.enqueue(13).unwrap(); assert_eq!(Ok(13), rx.dequeue().await); }
Trait Implementations
Auto Trait Implementations
impl<T> !RefUnwindSafe for AsyncReceiver<T>
impl<T> Send for AsyncReceiver<T>
impl<T> Sync for AsyncReceiver<T>
impl<T> Unpin for AsyncReceiver<T>
impl<T> !UnwindSafe for AsyncReceiver<T>