Struct dfqueue::DFQueueConsumer
source · pub struct DFQueueConsumer<T> { /* private fields */ }
Expand description
A consumer that can process (peek into) elements in a DFQueue, but not actually remove them. Do not wrap this in an Arc or Mutex, the queue it is already protected by those on the interior.
This does not provide a pop()
method like most queues,
because we do not permit the consumer to directly remove items from the queue.
Instead, we require that an element can only be removed from the queue once it has been marked complete,
providing a sort of transactional behavior.
Implementations§
source§impl<T> DFQueueConsumer<T>
impl<T> DFQueueConsumer<T>
sourcepub fn obtain_producer(&self) -> DFQueueProducer<T>
pub fn obtain_producer(&self) -> DFQueueProducer<T>
Returns a new DFQueueProducer cloned from this consumer instance, since there can be multiple producers.
sourcepub fn peek(&self) -> Option<PeekedData<T>>
pub fn peek(&self) -> Option<PeekedData<T>>
Returns the next non-completed element in the queue without actually removing it from the queue,
or None
if the queue is empty or in a temporarily-inconsistent state.
Trait Implementations§
Auto Trait Implementations§
impl<T> !RefUnwindSafe for DFQueueConsumer<T>
impl<T> Send for DFQueueConsumer<T>where T: Send,
impl<T> Sync for DFQueueConsumer<T>where T: Send,
impl<T> Unpin for DFQueueConsumer<T>
impl<T> !UnwindSafe for DFQueueConsumer<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