pub struct DynamicQueue<T, S = Auto>where
S: SlotType<T>,
T: AsPackedValue,{ /* private fields */ }Expand description
A lock-free, non-blocking queue, that may dynamically grow its capacity.
Implementations§
Source§impl<T> DynamicQueue<T, Auto>where
T: AsPackedValue,
impl<T> DynamicQueue<T, Auto>where
T: AsPackedValue,
Sourcepub fn new(size: usize) -> Self
pub fn new(size: usize) -> Self
Constructs a new DynamicQueue with capacity size and slot type Auto.
T must fit into the chosen slot type
Sourcepub fn with_slot<S>(size: usize) -> DynamicQueue<T, S>where
S: SlotType<T>,
pub fn with_slot<S>(size: usize) -> DynamicQueue<T, S>where
S: SlotType<T>,
Constructs a new DynamicQueue with capacity size and slot type S.
T must fit into the slot type S
Trait Implementations§
Source§impl<T, S> Growable for DynamicQueue<T, S>where
T: AsPackedValue,
S: SlotType<T>,
impl<T, S> Growable for DynamicQueue<T, S>where
T: AsPackedValue,
S: SlotType<T>,
Source§impl<T, S> MPMCQueue for DynamicQueue<T, S>where
T: AsPackedValue,
S: SlotType<T>,
impl<T, S> MPMCQueue for DynamicQueue<T, S>where
T: AsPackedValue,
S: SlotType<T>,
Source§fn push(&self, item: Self::Item) -> Result<(), Self::Item>
fn push(&self, item: Self::Item) -> Result<(), Self::Item>
Attempts to push an item into the queue.
Returns the item as an error if the queue is full. Read more
Source§fn pop(&self) -> Option<Self::Item>
fn pop(&self) -> Option<Self::Item>
Attempts to pop an item from the queue.
Returns
None if the queue was empty. Read moreSource§fn len(&self) -> usize
fn len(&self) -> usize
Returns the current len of the queue.
The returned value may be stale under concurrent access and should not be used for synchronization.
Source§fn is_empty(&self) -> bool
fn is_empty(&self) -> bool
Indicates whether the queue is empty.
The returned value may be stale under concurrent access and should not be used for synchronization.
Source§fn is_full(&self) -> bool
fn is_full(&self) -> bool
Indicates whether the queue is full.
The returned value may be stale under concurrent access and should not be used for synchronization.
Auto Trait Implementations§
impl<T, S = Auto> !Freeze for DynamicQueue<T, S>
impl<T, S> RefUnwindSafe for DynamicQueue<T, S>where
S: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, S> Send for DynamicQueue<T, S>
impl<T, S> Sync for DynamicQueue<T, S>
impl<T, S> Unpin for DynamicQueue<T, S>
impl<T, S> UnsafeUnpin for DynamicQueue<T, S>
impl<T, S> UnwindSafe for DynamicQueue<T, S>
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