pub struct HashTrieSet<T, P = RcK, H = RandomState>
where T: Eq + Hash, H: Clone + BuildHasher, P: SharedPointerKind,
{ /* 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

OperationAverageWorst 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>
where T: Eq + Hash,

source

pub fn new() -> HashTrieSet<T>

source

pub fn new_with_degree(degree: u8) -> HashTrieSet<T>

source§

impl<T> HashTrieSet<T, ArcTK>
where T: Eq + Hash,

source§

impl<T, P, H> HashTrieSet<T, P, H>
where T: Eq + Hash, H: Clone + BuildHasher, P: SharedPointerKind,

source

pub fn new_with_hasher_with_ptr_kind(hasher_builder: H) -> HashTrieSet<T, P, H>

source

pub fn new_with_hasher_and_degree_and_ptr_kind( hasher_builder: H, degree: u8 ) -> HashTrieSet<T, P, H>

source

pub fn insert(&self, v: T) -> HashTrieSet<T, P, H>

source

pub fn insert_mut(&mut self, v: T)

source

pub fn remove<V>(&self, v: &V) -> HashTrieSet<T, P, H>
where T: Borrow<V>, V: Hash + Eq + ?Sized,

source

pub fn remove_mut<V>(&mut self, v: &V) -> bool
where T: Borrow<V>, V: Hash + Eq + ?Sized,

source

pub fn get<V>(&self, v: &V) -> Option<&T>
where T: Borrow<V>, V: Hash + Eq + ?Sized,

source

pub fn contains<V>(&self, v: &V) -> bool
where T: Borrow<V>, V: Hash + Eq + ?Sized,

source

pub fn is_disjoint<HO: BuildHasher + Clone>( &self, other: &HashTrieSet<T, P, HO> ) -> bool

source

pub fn is_subset<HO: BuildHasher + Clone>( &self, other: &HashTrieSet<T, P, HO> ) -> bool

source

pub fn is_superset<HO: BuildHasher + Clone>( &self, other: &HashTrieSet<T, P, HO> ) -> bool

source

pub fn size(&self) -> usize

source

pub fn is_empty(&self) -> bool

source

pub fn iter(&self) -> Iter<'_, T, P>

Trait Implementations§

source§

impl<T, P, H> Clone for HashTrieSet<T, P, H>
where T: Eq + Hash, H: Clone + BuildHasher, P: SharedPointerKind,

source§

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)

Performs copy-assignment from source. Read more
source§

impl<T, P, H> Debug for HashTrieSet<T, P, H>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<T, P, H> Default for HashTrieSet<T, P, H>

source§

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>

source§

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>

source§

fn fmt(&self, fmt: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

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>

Creates a value from an iterator. Read more
source§

impl<'a, T, P, H> IntoIterator for &'a HashTrieSet<T, P, H>

§

type Item = &'a T

The type of the elements being iterated over.
§

type IntoIter = Map<Map<IterPtr<'a, T, (), P>, fn(_: &'a SharedPointer<Entry<T, ()>, P>) -> (&'a T, &'a ())>, fn(_: (&'a T, &())) -> &'a T>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Iter<'a, T, P>

Creates an iterator from a value. Read more
source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T, P, H> Serialize for HashTrieSet<T, P, H>

source§

fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error>

Serialize this value into the given Serde serializer. Read more
source§

impl<T, P, H> Eq for HashTrieSet<T, P, H>
where T: Hash + Eq, H: Clone + BuildHasher, P: SharedPointerKind,

Auto Trait Implementations§

§

impl<T, P, H> RefUnwindSafe for HashTrieSet<T, P, H>

§

impl<T, P, H> Send for HashTrieSet<T, P, H>
where H: Send, P: Send + Sync, T: Send + Sync,

§

impl<T, P, H> Sync for HashTrieSet<T, P, H>
where H: Sync, P: Send + Sync, T: Send + Sync,

§

impl<T, P, H> Unpin for HashTrieSet<T, P, H>
where H: Unpin,

§

impl<T, P, H> UnwindSafe for HashTrieSet<T, P, H>
where H: UnwindSafe, P: UnwindSafe, T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,