Struct rpds::set::hash_trie_set::HashTrieSet
source · pub struct HashTrieSet<T, P = RcK, H = RandomState>{ /* private fields */ }
Expand description
A persistent set with structural sharing. This implementation uses a hash array mapped trie.
Complexity
Let n be the number of elements in the set.
Temporal complexity
Operation | Average | Worst case |
---|---|---|
new() | Θ(1) | Θ(1) |
insert() | Θ(1) | Θ(n) |
remove() | Θ(1) | Θ(n) |
get() | Θ(1) | Θ(n) |
contains() | Θ(1) | Θ(n) |
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 HashTrieMap
.
Implementations§
source§impl<T> HashTrieSet<T, RcK, RandomState>
impl<T> HashTrieSet<T, RcK, RandomState>
pub fn new() -> HashTrieSet<T>
pub fn new_with_degree(degree: u8) -> HashTrieSet<T>
source§impl<T> HashTrieSet<T, ArcTK>
impl<T> HashTrieSet<T, ArcTK>
pub fn new_sync() -> HashTrieSetSync<T>
pub fn new_with_degree_sync(degree: u8) -> HashTrieSetSync<T>
source§impl<T, P, H> HashTrieSet<T, P, H>
impl<T, P, H> HashTrieSet<T, P, H>
pub fn new_with_hasher_with_ptr_kind(hasher_builder: H) -> HashTrieSet<T, P, H>
pub fn new_with_hasher_and_degree_and_ptr_kind( hasher_builder: H, degree: u8 ) -> HashTrieSet<T, P, H>
pub fn insert(&self, v: T) -> HashTrieSet<T, P, H>
pub fn insert_mut(&mut self, v: T)
pub fn remove<V>(&self, v: &V) -> HashTrieSet<T, P, H>
pub fn remove_mut<V>(&mut self, v: &V) -> bool
pub fn get<V>(&self, v: &V) -> Option<&T>
pub fn contains<V>(&self, v: &V) -> bool
pub fn is_disjoint<HO: BuildHasher + Clone>( &self, other: &HashTrieSet<T, P, HO> ) -> bool
pub fn is_subset<HO: BuildHasher + Clone>( &self, other: &HashTrieSet<T, P, HO> ) -> bool
pub fn is_superset<HO: BuildHasher + Clone>( &self, other: &HashTrieSet<T, P, HO> ) -> bool
pub fn size(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn iter(&self) -> Iter<'_, T, P>
Trait Implementations§
source§impl<T, P, H> Clone for HashTrieSet<T, P, H>
impl<T, P, H> Clone for HashTrieSet<T, P, H>
source§fn clone(&self) -> HashTrieSet<T, P, H>
fn clone(&self) -> HashTrieSet<T, P, H>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<T, P, H> Debug for HashTrieSet<T, P, H>
impl<T, P, H> Debug for HashTrieSet<T, P, H>
source§impl<T, P, H> Default for HashTrieSet<T, P, H>
impl<T, P, H> Default for HashTrieSet<T, P, H>
source§fn default() -> HashTrieSet<T, P, H>
fn default() -> HashTrieSet<T, P, H>
Returns the “default value” for a type. Read more
source§impl<'de, T, P, H> Deserialize<'de> for HashTrieSet<T, P, H>
impl<'de, T, P, H> Deserialize<'de> for HashTrieSet<T, P, H>
source§fn deserialize<D: Deserializer<'de>>(
deserializer: D
) -> Result<HashTrieSet<T, P, H>, D::Error>
fn deserialize<D: Deserializer<'de>>( deserializer: D ) -> Result<HashTrieSet<T, P, H>, D::Error>
Deserialize this value from the given Serde deserializer. Read more
source§impl<T, P, H> Display for HashTrieSet<T, P, H>
impl<T, P, H> Display for HashTrieSet<T, P, H>
source§impl<T, P, H> FromIterator<T> for HashTrieSet<T, P, H>
impl<T, P, H> FromIterator<T> for HashTrieSet<T, P, H>
source§fn from_iter<I: IntoIterator<Item = T>>(into_iter: I) -> HashTrieSet<T, P, H>
fn from_iter<I: IntoIterator<Item = T>>(into_iter: I) -> HashTrieSet<T, P, H>
Creates a value from an iterator. Read more
source§impl<'a, T, P, H> IntoIterator for &'a HashTrieSet<T, P, H>
impl<'a, T, P, H> IntoIterator for &'a HashTrieSet<T, P, H>
source§impl<T, P, PO, H> PartialEq<HashTrieSet<T, PO, H>> for HashTrieSet<T, P, H>
impl<T, P, PO, H> PartialEq<HashTrieSet<T, PO, H>> for HashTrieSet<T, P, H>
source§fn eq(&self, other: &HashTrieSet<T, PO, H>) -> bool
fn eq(&self, other: &HashTrieSet<T, PO, H>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl<T, P, H> Serialize for HashTrieSet<T, P, H>
impl<T, P, H> Serialize for HashTrieSet<T, P, H>
impl<T, P, H> Eq for HashTrieSet<T, P, H>
Auto Trait Implementations§
impl<T, P, H> RefUnwindSafe for HashTrieSet<T, P, H>
impl<T, P, H> Send for HashTrieSet<T, P, H>
impl<T, P, H> Sync for HashTrieSet<T, P, H>
impl<T, P, H> Unpin for HashTrieSet<T, P, H>where
H: Unpin,
impl<T, P, H> UnwindSafe for HashTrieSet<T, P, H>
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