Struct rpds::queue::Queue [−][src]
pub struct Queue<T, P = RcK> where
P: SharedPointerKind, { /* fields omitted */ }
Expand description
A persistent queue with structural sharing.
Complexity
Let n be the number of elements in the queue.
Temporal complexity
Operation | Average | Worst 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
Trait Implementations
impl<'de, T, P> Deserialize<'de> for Queue<T, P> where
T: Deserialize<'de>,
P: SharedPointerKind,
impl<'de, T, P> Deserialize<'de> for Queue<T, P> where
T: Deserialize<'de>,
P: SharedPointerKind,
Deserialize this value from the given Serde deserializer. Read more
Creates a value from an iterator. Read more
impl<T: PartialEq, P, PO> PartialEq<Queue<T, PO>> for Queue<T, P> where
P: SharedPointerKind,
PO: SharedPointerKind,
impl<T: PartialEq, P, PO> PartialEq<Queue<T, PO>> for Queue<T, P> where
P: SharedPointerKind,
PO: SharedPointerKind,
impl<T: PartialOrd<T>, P, PO> PartialOrd<Queue<T, PO>> for Queue<T, P> where
P: SharedPointerKind,
PO: SharedPointerKind,
impl<T: PartialOrd<T>, P, PO> PartialOrd<Queue<T, PO>> for Queue<T, P> where
P: SharedPointerKind,
PO: SharedPointerKind,
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Auto Trait Implementations
impl<T, P> RefUnwindSafe for Queue<T, P> where
P: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, P> UnwindSafe for Queue<T, P> where
P: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more