Struct rpds::stack::Stack [−][src]
pub struct Stack<T, P = RcK> where
P: SharedPointerKind, { /* fields omitted */ }Expand description
A persistent stack with structural sharing.
Complexity
Let n be the number of elements in the stack.
Temporal complexity
| Operation | Average | Worst case |
|---|---|---|
new() | Θ(1) | Θ(1) |
push() | Θ(1) | Θ(1) |
pop() | Θ(1) | Θ(1) |
peek() | Θ(1) | Θ(1) |
size() | Θ(1) | Θ(1) |
clone() | Θ(1) | Θ(1) |
| iterator creation | Θ(1) | Θ(1) |
| iterator step | Θ(1) | Θ(1) |
| iterator full | Θ(n) | Θ(n) |
Implementation details
This is a thin wrapper around a List.
Implementations
Trait Implementations
impl<'de, T, P> Deserialize<'de> for Stack<T, P> where
T: Deserialize<'de>,
P: SharedPointerKind,
impl<'de, T, P> Deserialize<'de> for Stack<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<Stack<T, PO>> for Stack<T, P> where
P: SharedPointerKind,
PO: SharedPointerKind,
impl<T: PartialEq, P, PO> PartialEq<Stack<T, PO>> for Stack<T, P> where
P: SharedPointerKind,
PO: SharedPointerKind,
impl<T: PartialOrd<T>, P, PO> PartialOrd<Stack<T, PO>> for Stack<T, P> where
P: SharedPointerKind,
PO: SharedPointerKind,
impl<T: PartialOrd<T>, P, PO> PartialOrd<Stack<T, PO>> for Stack<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 Stack<T, P> where
P: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, P> UnwindSafe for Stack<T, P> where
P: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
