pub struct ItemQueue { /* private fields */ }Expand description
A thread-safe, multi-producer / multi-consumer queue of Items.
Cloning an ItemQueue yields another handle to the same underlying native
queue, so items pushed through one clone are visible to all.
Implementations§
Source§impl ItemQueue
impl ItemQueue
Sourcepub fn push(&self, item: &Item) -> Result<(), FoundryLocalError>
pub fn push(&self, item: &Item) -> Result<(), FoundryLocalError>
Push an item onto the queue, transferring a native copy into it.
Sourcepub fn try_pop(&self) -> Result<Option<Item>, FoundryLocalError>
pub fn try_pop(&self) -> Result<Option<Item>, FoundryLocalError>
Pop the next available item, or None if the queue is currently empty.
Sourcepub fn mark_finished(&self)
pub fn mark_finished(&self)
Signal that no more items will be pushed. A consumer draining the queue can then stop once it is empty.
Sourcepub fn is_finished(&self) -> bool
pub fn is_finished(&self) -> bool
Whether mark_finished has been called.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ItemQueue
impl RefUnwindSafe for ItemQueue
impl Send for ItemQueue
impl Sync for ItemQueue
impl Unpin for ItemQueue
impl UnsafeUnpin for ItemQueue
impl UnwindSafe for ItemQueue
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