Struct rpds::vector::Vector[][src]

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

A persistent vector with structural sharing.

Complexity

Let n be the number of elements in the vector.

Temporal complexity

OperationAverageWorst case
new()Θ(1)Θ(1)
set()Θ(log(n))Θ(log(n))
push_back()Θ(log(n))Θ(log(n))
drop_last()Θ(log(n))Θ(log(n))
first()/last()/get()Θ(log(n))Θ(log(n))
len()Θ(1)Θ(1)
clone()Θ(1)Θ(1)
iterator creationΘ(1)Θ(1)
iterator stepΘ(1)Θ(log(n))
iterator fullΘ(n)Θ(n)

Implementation details

This implementation uses a bitmapped vector trie as described in Understanding Persistent Vector Part 1 and Understanding Persistent Vector Part 2.

Implementations

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

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

impl<T> Vector<T>[src]

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

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

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

#[must_use]pub fn new_with_bits(bits: u8) -> Vector<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 get(&self, index: usize) -> Option<&T>[src]

#[must_use]pub fn set(&self, index: usize, v: T) -> Option<Vector<T, P>>[src]

pub fn set_mut(&mut self, index: usize, v: T) -> bool[src]

Returns true if the operation was successful.

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

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

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

pub fn drop_last_mut(&mut self) -> bool[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]

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

#[must_use]pub fn get_mut(&mut self, index: usize) -> Option<&mut T>[src]

Gets a mutable reference to an element. If the element is shared, it will be cloned. Returns None if and only if the given index is out of range.

Trait Implementations

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

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

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

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

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

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

impl<T, P> Extend<T> for Vector<T, P> where
    P: SharedPointerKind
[src]

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

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

impl<T, P> Index<usize> for Vector<T, P> where
    P: SharedPointerKind
[src]

type Output = T

The returned type after indexing.

impl<T: Clone, P> IndexMut<usize> for Vector<T, P> where
    P: SharedPointerKind
[src]

impl<'a, T, P> IntoIterator for &'a Vector<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 Vector<T, P> where
    P: SharedPointerKind
[src]

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

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

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

Auto Trait Implementations

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

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

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

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

impl<T, P> UnwindSafe for Vector<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.