Struct rpds::list::List [−][src]
A persistent list with structural sharing.
Complexity
Let n be the number of elements in the list.
Temporal complexity
Operation | Average | Worst case |
---|---|---|
new() | Θ(1) | Θ(1) |
push_front() | Θ(1) | Θ(1) |
drop_first() | Θ(1) | Θ(1) |
reverse() | Θ(n) | Θ(n) |
first() | Θ(1) | Θ(1) |
last() | Θ(1) | Θ(1) |
len() | Θ(1) | Θ(1) |
clone() | Θ(1) | Θ(1) |
iterator creation | Θ(1) | Θ(1) |
iterator step | Θ(1) | Θ(1) |
iterator full | Θ(n) | Θ(n) |
Implementation details
This is your classic functional list with "cons" and "nil" nodes, with a little extra sauce to make some operations more efficient.
Implementations
impl<T> List<T, ArcK>
[src]
impl<T> List<T>
[src]
impl<T, P> List<T, P> where
P: SharedPointerKind,
[src]
P: SharedPointerKind,
#[must_use]pub fn new_with_ptr_kind() -> List<T, P>
[src]
#[must_use]pub fn first(&self) -> Option<&T>
[src]
#[must_use]pub fn last(&self) -> Option<&T>
[src]
#[must_use]pub fn drop_first(&self) -> Option<List<T, P>>
[src]
pub fn drop_first_mut(&mut self) -> bool
[src]
#[must_use]pub fn push_front(&self, v: T) -> List<T, P>
[src]
pub fn push_front_mut(&mut self, v: T)
[src]
#[must_use]pub fn reverse(&self) -> List<T, P>
[src]
pub fn reverse_mut(&mut self)
[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 List<T, P> where
P: SharedPointerKind,
[src]
P: SharedPointerKind,
impl<T: Debug, P: Debug> Debug for List<T, P> where
P: SharedPointerKind,
[src]
P: SharedPointerKind,
impl<T, P> Default for List<T, P> where
P: SharedPointerKind,
[src]
P: SharedPointerKind,
impl<'de, T, P> Deserialize<'de> for List<T, P> where
T: Deserialize<'de>,
P: SharedPointerKind,
[src]
T: Deserialize<'de>,
P: SharedPointerKind,
fn deserialize<D: Deserializer<'de>>(
deserializer: D
) -> Result<List<T, P>, D::Error>
[src]
deserializer: D
) -> Result<List<T, P>, D::Error>
impl<T: Display, P> Display for List<T, P> where
P: SharedPointerKind,
[src]
P: SharedPointerKind,
impl<T, P> Drop for List<T, P> where
P: SharedPointerKind,
[src]
P: SharedPointerKind,
impl<T: Eq, P> Eq for List<T, P> where
P: SharedPointerKind,
[src]
P: SharedPointerKind,
impl<T, P> FromIterator<T> for List<T, P> where
P: SharedPointerKind,
[src]
P: SharedPointerKind,
fn from_iter<I: IntoIterator<Item = T>>(into_iter: I) -> List<T, P>
[src]
impl<T: Hash, P> Hash for List<T, P> where
P: SharedPointerKind,
[src]
P: SharedPointerKind,
fn hash<H: Hasher>(&self, state: &mut H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<'a, T, P> IntoIterator for &'a List<T, P> where
P: SharedPointerKind,
[src]
P: SharedPointerKind,
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?
fn into_iter(self) -> Iter<'a, T, P>
[src]
impl<T: Ord, P> Ord for List<T, P> where
P: SharedPointerKind,
[src]
P: SharedPointerKind,
fn cmp(&self, other: &List<T, P>) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl<T: PartialEq, P, PO> PartialEq<List<T, PO>> for List<T, P> where
P: SharedPointerKind,
PO: SharedPointerKind,
[src]
P: SharedPointerKind,
PO: SharedPointerKind,
fn eq(&self, other: &List<T, PO>) -> bool
[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl<T: PartialOrd<T>, P, PO> PartialOrd<List<T, PO>> for List<T, P> where
P: SharedPointerKind,
PO: SharedPointerKind,
[src]
P: SharedPointerKind,
PO: SharedPointerKind,
fn partial_cmp(&self, other: &List<T, PO>) -> Option<Ordering>
[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<T, P> Serialize for List<T, P> where
T: Serialize,
P: SharedPointerKind,
[src]
T: Serialize,
P: SharedPointerKind,
Auto Trait Implementations
impl<T, P> RefUnwindSafe for List<T, P> where
P: RefUnwindSafe,
T: RefUnwindSafe,
P: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, P> Send for List<T, P> where
P: Send,
T: Send,
P: Send,
T: Send,
impl<T, P> Sync for List<T, P> where
P: Sync,
T: Sync,
P: Sync,
T: Sync,
impl<T, P> Unpin for List<T, P> where
P: Unpin,
T: Unpin,
P: Unpin,
T: Unpin,
impl<T, P> UnwindSafe for List<T, P> where
P: UnwindSafe,
T: UnwindSafe,
P: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,