Struct rpds::queue::Queue[][src]

pub struct Queue<T, P = RcK> where
    P: SharedPointerKind
{ /* fields omitted */ }

A persistent queue with structural sharing.

Complexity

Let n be the number of elements in the queue.

Temporal complexity

OperationAverageWorst case
new()Θ(1)Θ(1)
enqueue()Θ(1)Θ(1)
dequeue()Θ(1)Θ(n)
dequeue() amortizedΘ(1)Θ(1)
peek()Θ(1)Θ(1)
len()Θ(1)Θ(1)
clone()Θ(1)Θ(1)
iterator creationΘ(1)Θ(1)
iterator stepΘ(1)Θ(n)
iterator fullΘ(n)Θ(n)

Implementation details

This queue is implemented as described in Immutability in C# Part Four: An Immutable Queue.

Implementations

impl<T> Queue<T, ArcK>[src]

#[must_use]pub fn new_sync() -> QueueSync<T>[src]

impl<T> Queue<T>[src]

#[must_use]pub fn new() -> Queue<T>[src]

impl<T, P> Queue<T, P> where
    P: SharedPointerKind
[src]

#[must_use]pub fn new_with_ptr_kind() -> Queue<T, P>[src]

#[must_use]pub fn peek(&self) -> Option<&T>[src]

#[must_use]pub fn dequeue(&self) -> Option<Queue<T, P>>[src]

pub fn dequeue_mut(&mut self) -> bool[src]

#[must_use]pub fn enqueue(&self, v: T) -> Queue<T, P>[src]

pub fn enqueue_mut(&mut self, v: T)[src]

#[must_use]pub fn len(&self) -> usize[src]

#[must_use]pub fn is_empty(&self) -> bool[src]

#[must_use]pub fn iter(&self) -> Iter<'_, T, P>[src]

Trait Implementations

impl<T, P> Clone for Queue<T, P> where
    P: SharedPointerKind
[src]

impl<T: Debug, P: Debug> Debug for Queue<T, P> where
    P: SharedPointerKind
[src]

impl<T, P> Default for Queue<T, P> where
    P: SharedPointerKind
[src]

impl<'de, T, P> Deserialize<'de> for Queue<T, P> where
    T: Deserialize<'de>,
    P: SharedPointerKind
[src]

impl<T: Display, P> Display for Queue<T, P> where
    P: SharedPointerKind
[src]

impl<T: Eq, P> Eq for Queue<T, P> where
    P: SharedPointerKind
[src]

impl<T, P> FromIterator<T> for Queue<T, P> where
    P: SharedPointerKind
[src]

impl<T: Hash, P> Hash for Queue<T, P> where
    P: SharedPointerKind
[src]

impl<'a, T, P> IntoIterator for &'a Queue<T, P> where
    P: SharedPointerKind
[src]

type Item = &'a T

The type of the elements being iterated over.

type IntoIter = Iter<'a, T, P>

Which kind of iterator are we turning this into?

impl<T: Ord, P> Ord for Queue<T, P> where
    P: SharedPointerKind
[src]

impl<T: PartialEq, P, PO> PartialEq<Queue<T, PO>> for Queue<T, P> where
    P: SharedPointerKind,
    PO: SharedPointerKind
[src]

impl<T: PartialOrd<T>, P, PO> PartialOrd<Queue<T, PO>> for Queue<T, P> where
    P: SharedPointerKind,
    PO: SharedPointerKind
[src]

impl<T, P> Serialize for Queue<T, P> where
    T: Serialize,
    P: SharedPointerKind
[src]

Auto Trait Implementations

impl<T, P> RefUnwindSafe for Queue<T, P> where
    P: RefUnwindSafe,
    T: RefUnwindSafe

impl<T, P> Send for Queue<T, P> where
    P: Send,
    T: Send

impl<T, P> Sync for Queue<T, P> where
    P: Sync,
    T: Sync

impl<T, P> Unpin for Queue<T, P> where
    P: Unpin,
    T: Unpin

impl<T, P> UnwindSafe for Queue<T, P> where
    P: UnwindSafe,
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.