pub struct PersistentHashSet { /* private fields */ }Expand description
An immutable hash set that preserves insertion order when iterated.
Uses the same index-plus-ordered-log technique as PersistentHashMap:
a rpds::HashTrieMap from value to insertion sequence number, and a
rpds::RedBlackTreeMap from sequence number to value that is iterated in
order. This keeps iteration deterministic and matching insertion order,
rather than depending on hash-bucket layout — rpds seeds its hasher
randomly per instance, so raw hash-order iteration would otherwise vary
from run to run.
Implementations§
Source§impl PersistentHashSet
impl PersistentHashSet
pub fn empty() -> Self
pub fn count(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn contains(&self, val: &Value) -> bool
Sourcepub fn conj(&self, val: Value) -> Self
pub fn conj(&self, val: Value) -> Self
Return a new set with val added.
If val is already present, its original insertion position is kept.
pub fn conj_mut(&mut self, val: Value) -> &mut Self
Trait Implementations§
Source§impl Clone for PersistentHashSet
impl Clone for PersistentHashSet
Source§fn clone(&self) -> PersistentHashSet
fn clone(&self) -> PersistentHashSet
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 PersistentHashSet
impl Debug for PersistentHashSet
Source§impl FromIterator<Value> for PersistentHashSet
impl FromIterator<Value> for PersistentHashSet
Source§impl PartialEq for PersistentHashSet
impl PartialEq for PersistentHashSet
Source§impl Trace for PersistentHashSet
impl Trace for PersistentHashSet
fn trace(&self, visitor: &mut MarkVisitor)
fn gc_size_extra(&self) -> usize
Auto Trait Implementations§
impl !RefUnwindSafe for PersistentHashSet
impl !Send for PersistentHashSet
impl !Sync for PersistentHashSet
impl !UnwindSafe for PersistentHashSet
impl Freeze for PersistentHashSet
impl Unpin for PersistentHashSet
impl UnsafeUnpin for PersistentHashSet
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