pub struct PersistentVector { /* private fields */ }Expand description
An immutable persistent vector backed by rpds::Vector.
A vector may additionally be tagged as a map entry (see
PersistentVector::map_entry): a two-element [key val] pair produced
by seq’ing a map, find, or the map-entry builtin. Map entries behave
exactly like vectors (equality, hashing, printing, indexing) — the tag
only answers map-entry? — and, as in Clojure, any derived vector
(conj, assoc, pop, …) is a plain vector again.
Implementations§
Source§impl PersistentVector
impl PersistentVector
pub fn empty() -> Self
pub fn from_vector(vector: VectorSync<Value>) -> Self
Sourcepub fn is_map_entry(&self) -> bool
pub fn is_map_entry(&self) -> bool
True only for vectors created via PersistentVector::map_entry.
pub fn count(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn nth(&self, idx: usize) -> Option<&Value>
pub fn nth(&self, idx: usize) -> Option<&Value>
Return the element at idx, or None if out of bounds.
Sourcepub fn assoc_nth(&self, idx: usize, val: Value) -> Option<Self>
pub fn assoc_nth(&self, idx: usize, val: Value) -> Option<Self>
Return a new vector with element idx replaced, or appended if idx == len.
pub fn inner(&self) -> &VectorSync<Value>
Trait Implementations§
Source§impl Clone for PersistentVector
impl Clone for PersistentVector
Source§fn clone(&self) -> PersistentVector
fn clone(&self) -> PersistentVector
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PersistentVector
impl Debug for PersistentVector
Source§impl FromIterator<Value> for PersistentVector
impl FromIterator<Value> for PersistentVector
Source§impl PartialEq for PersistentVector
impl PartialEq for PersistentVector
Source§impl Trace for PersistentVector
impl Trace for PersistentVector
fn trace(&self, visitor: &mut MarkVisitor)
fn gc_size_extra(&self) -> usize
Auto Trait Implementations§
impl !RefUnwindSafe for PersistentVector
impl !Send for PersistentVector
impl !Sync for PersistentVector
impl !UnwindSafe for PersistentVector
impl Freeze for PersistentVector
impl Unpin for PersistentVector
impl UnsafeUnpin for PersistentVector
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more