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>
impl<T> HashTrieSet<T>
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() -> HashTrieSet<T, ArcTK>
pub fn new_with_degree_sync(degree: u8) -> HashTrieSet<T, ArcTK>
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>(&self, other: &HashTrieSet<T, P, HO>) -> boolwhere
HO: BuildHasher + Clone,
Sourcepub fn ptr_eq<PO, HO>(&self, other: &HashTrieSet<T, PO, HO>) -> bool
pub fn ptr_eq<PO, HO>(&self, other: &HashTrieSet<T, PO, HO>) -> bool
Test whether the two sets refer to the same content in memory.
This would return true if you’re comparing a set to itself, or if you’re comparing a set to a fresh clone of itself.
pub fn is_subset<HO>(&self, other: &HashTrieSet<T, P, HO>) -> boolwhere
HO: BuildHasher + Clone,
pub fn is_superset<HO>(&self, other: &HashTrieSet<T, P, HO>) -> boolwhere
HO: BuildHasher + Clone,
pub fn size(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn iter( &self, ) -> Map<Map<IterPtr<'_, T, (), P>, fn(&SharedPointer<Entry<T, ()>, P>) -> (&T, &())>, fn((&T, &())) -> &T> ⓘ
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 duplicate 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: D,
) -> Result<HashTrieSet<T, P, H>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<HashTrieSet<T, P, H>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
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>(into_iter: I) -> HashTrieSet<T, P, H>where
I: IntoIterator<Item = T>,
fn from_iter<I>(into_iter: I) -> HashTrieSet<T, P, H>where
I: IntoIterator<Item = T>,
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§impl<T, P, H> Serialize for HashTrieSet<T, P, H>
impl<T, P, H> Serialize for HashTrieSet<T, P, H>
Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl<T, P, H> Eq for HashTrieSet<T, P, H>
Auto Trait Implementations§
impl<T, P, H> Freeze for HashTrieSet<T, P, H>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more