pub struct StochasticQueue<T> { /* private fields */ }
Expand description
A queue which pops items at random uniformly. It cannot be iterated or peeked.
Implementations§
Source§impl<T> StochasticQueue<T>
impl<T> StochasticQueue<T>
Sourcepub fn with_capacity(cap: usize) -> Self
pub fn with_capacity(cap: usize) -> Self
Create a queue with an initial capacity.
Sourcepub fn peek_iter(&self) -> impl Iterator<Item = &T>
pub fn peek_iter(&self) -> impl Iterator<Item = &T>
Returns an iterator over all items in the queue without popping them. The order is arbitrary.
Sourcepub fn push(&mut self, val: T)
pub fn push(&mut self, val: T)
Adds an item to the queue. When it will be chosen to be popped is nondeterministic.
Auto Trait Implementations§
impl<T> Freeze for StochasticQueue<T>
impl<T> RefUnwindSafe for StochasticQueue<T>where
T: RefUnwindSafe,
impl<T> Send for StochasticQueue<T>where
T: Send,
impl<T> Sync for StochasticQueue<T>where
T: Sync,
impl<T> Unpin for StochasticQueue<T>where
T: Unpin,
impl<T> UnwindSafe for StochasticQueue<T>where
T: 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