Struct SegQueue
struct SegQueue<T> { ... }
An unbounded multi-producer multi-consumer queue.
This queue is implemented as a linked list of segments, where each segment is a small buffer
that can hold a handful of elements. There is no limit to how many elements can be in the queue
at a time. However, since segments need to be dynamically allocated as elements get pushed,
this queue is somewhat slower than ArrayQueue.
Examples
use SegQueue;
let q = new;
q.push;
q.push;
assert_eq!;
assert_eq!;
assert!;
Implementations
impl<T> SegQueue<T>
const fn new() -> SegQueue<T>Creates a new unbounded queue.
Examples
use SegQueue; let q = new;fn push(self: &Self, value: T)Pushes an element into the queue.
Examples
use SegQueue; let q = new; q.push; q.push;fn pop(self: &Self) -> Option<T>Pops an element from the queue.
If the queue is empty,
Noneis returned.Examples
use SegQueue; let q = new; q.push; assert_eq!; assert!;fn is_empty(self: &Self) -> boolReturns
trueif the queue is empty.Examples
use SegQueue; let q = new; assert!; q.push; assert!;fn len(self: &Self) -> usizeReturns the number of elements in the queue.
Examples
use SegQueue; let q = new; assert_eq!; q.push; assert_eq!; q.push; assert_eq!;
impl<T> Any for SegQueue<T>
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for SegQueue<T>
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for SegQueue<T>
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> Debug for SegQueue<T>
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result
impl<T> Default for SegQueue<T>
fn default() -> SegQueue<T>
impl<T> Drop for SegQueue<T>
fn drop(self: &mut Self)
impl<T> Freeze for SegQueue<T>
impl<T> From for SegQueue<T>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> IntoIterator for SegQueue<T>
fn into_iter(self: Self) -> <Self as >::IntoIter
impl<T> RefUnwindSafe for SegQueue<T>
impl<T> Unpin for SegQueue<T>
impl<T> UnsafeUnpin for SegQueue<T>
impl<T> UnwindSafe for SegQueue<T>
impl<T, U> Into for SegQueue<T>
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for SegQueue<T>
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for SegQueue<T>
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>