pub struct StaticQueue<T, const N: usize, S = Auto>where
T: AsPackedValue,
S: SlotType<T>,{ /* private fields */ }Expand description
A MPMCQueue with capacity N.
This queue only accepts items that implememt PtrLike.
If you need to store larger types, consider using PooledStaticQueue instead.
Implementations§
Source§impl<T, const N: usize> StaticQueue<T, N, Auto>where
T: AsPackedValue,
impl<T, const N: usize> StaticQueue<T, N, Auto>where
T: AsPackedValue,
Sourcepub fn new() -> Self
pub fn new() -> Self
Constructs a new StaticQueue with slot type Auto.
T must fit into the chosen slot type
Sourcepub fn with_slot<S>() -> StaticQueue<T, N, S>where
S: SlotType<T>,
pub fn with_slot<S>() -> StaticQueue<T, N, S>where
S: SlotType<T>,
Constructs a new StaticQueue with slot type S.
T must fit into the slot type S
Trait Implementations§
Source§impl<T, const N: usize> Default for StaticQueue<T, N, Auto>where
T: AsPackedValue,
impl<T, const N: usize> Default for StaticQueue<T, N, Auto>where
T: AsPackedValue,
Source§impl<T, const N: usize, S> MPMCQueue for StaticQueue<T, N, S>where
T: AsPackedValue,
S: SlotType<T>,
impl<T, const N: usize, S> MPMCQueue for StaticQueue<T, N, 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, const N: usize, S = Auto> !Freeze for StaticQueue<T, N, S>
impl<T, const N: usize, S> RefUnwindSafe for StaticQueue<T, N, S>where
<S as SlotType<T>>::Slot: RefUnwindSafe,
impl<T, const N: usize, S> Send for StaticQueue<T, N, S>where
<S as SlotType<T>>::Slot: Send,
impl<T, const N: usize, S> Sync for StaticQueue<T, N, S>where
<S as SlotType<T>>::Slot: Sync,
impl<T, const N: usize, S> Unpin for StaticQueue<T, N, S>where
<S as SlotType<T>>::Slot: Unpin,
impl<T, const N: usize, S> UnsafeUnpin for StaticQueue<T, N, S>where
<S as SlotType<T>>::Slot: UnsafeUnpin,
impl<T, const N: usize, S> UnwindSafe for StaticQueue<T, N, S>where
<S as SlotType<T>>::Slot: UnwindSafe,
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