pub struct FzStringSet<T, BH = DefaultBuildHasher> { /* private fields */ }Expand description
A set optimized for fast read access with string values.
A frozen collection differs from the traditional Rust collections, such as
HashMap and HashSet types in three
key ways. First, creating a frozen collection performs an analysis over the input data to
determine the best implementation strategy. Depending on the situation, this analysis is
performed at build time or runtime, and it can take a relatively long time when a collection is
very large. Second, once created, the keys in frozen collections are immutable. And third,
querying a frozen collection is typically considerably faster, which is the whole point.
This type requires that the keys
implement the Eq and Hash traits. This can frequently be achieved by
using #[derive(PartialEq, Eq, Hash)]. If you implement these yourself,
it is important that the following property holds:
k1 == k2 -> hash(k1) == hash(k2)In other words, if two keys are equal, their hashes must be equal. Violating this property is a logic error.
It is also a logic error for a key to be modified in such a way that the key’s
hash, as determined by the Hash trait, or its equality, as determined by
the Eq trait, changes while it is in the collection. This is normally only
possible through core::cell::Cell, core::cell::RefCell, global state, I/O,
or unsafe code.
The behavior resulting from either logic error can include panics, incorrect results, memory leaks, and non-termination.
Implementations§
Source§impl FzStringSet<Box<str>, DefaultBuildHasher>
impl FzStringSet<Box<str>, DefaultBuildHasher>
Source§impl<BH> FzStringSet<Box<str>, BH>
impl<BH> FzStringSet<Box<str>, BH>
Sourcepub fn with_hasher(entries: Vec<impl AsRef<str>>, bh: BH) -> Self
pub fn with_hasher(entries: Vec<impl AsRef<str>>, bh: BH) -> Self
Creates a new frozen set which uses the given hash builder to hash values. If the input contains duplicate value, the latter one in the input is used and all former ones are discarded.
Source§impl<'a> FzStringSet<&'a str, DefaultBuildHasher>
impl<'a> FzStringSet<&'a str, DefaultBuildHasher>
Sourcepub fn new_for_str(entries: Vec<&'a str>) -> Self
pub fn new_for_str(entries: Vec<&'a str>) -> Self
Creates a new frozen set. If the input contains duplicate value, the latter one in the input is used and all former ones are discarded.
Source§impl<'a, BH> FzStringSet<&'a str, BH>
impl<'a, BH> FzStringSet<&'a str, BH>
Sourcepub fn with_hasher_for_str(entries: Vec<&'a str>, bh: BH) -> Self
pub fn with_hasher_for_str(entries: Vec<&'a str>, bh: BH) -> Self
Creates a new frozen set which uses the given hash builder to hash values. If the input contains duplicate value, the latter one in the input is used and all former ones are discarded.
Trait Implementations§
Source§impl<T, ST, BH> BitAnd<&ST> for &FzStringSet<T, BH>
impl<T, ST, BH> BitAnd<&ST> for &FzStringSet<T, BH>
Source§impl<T, ST, BH> BitOr<&ST> for &FzStringSet<T, BH>
impl<T, ST, BH> BitOr<&ST> for &FzStringSet<T, BH>
Source§impl<T, ST, BH> BitXor<&ST> for &FzStringSet<T, BH>
impl<T, ST, BH> BitXor<&ST> for &FzStringSet<T, BH>
Source§impl<T: Clone, BH: Clone> Clone for FzStringSet<T, BH>
impl<T: Clone, BH: Clone> Clone for FzStringSet<T, BH>
Source§fn clone(&self) -> FzStringSet<T, BH>
fn clone(&self) -> FzStringSet<T, BH>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<T, BH> Debug for FzStringSet<T, BH>where
T: Debug,
impl<T, BH> Debug for FzStringSet<T, BH>where
T: Debug,
Source§impl<'de, BH> Deserialize<'de> for FzStringSet<Box<str>, BH>
Available on crate feature serde only.
impl<'de, BH> Deserialize<'de> for FzStringSet<Box<str>, BH>
serde only.Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Source§impl<T, BH> From<FzStringMap<T, (), BH>> for FzStringSet<T, BH>
impl<T, BH> From<FzStringMap<T, (), BH>> for FzStringSet<T, BH>
Source§fn from(map: FzStringMap<T, (), BH>) -> Self
fn from(map: FzStringMap<T, (), BH>) -> Self
Source§impl<'a, BH> FromIterator<&'a str> for FzStringSet<&'a str, BH>
impl<'a, BH> FromIterator<&'a str> for FzStringSet<&'a str, BH>
Source§impl<T, BH> FromIterator<T> for FzStringSet<Box<str>, BH>
impl<T, BH> FromIterator<T> for FzStringSet<Box<str>, BH>
Source§fn from_iter<IT: IntoIterator<Item = T>>(iter: IT) -> Self
fn from_iter<IT: IntoIterator<Item = T>>(iter: IT) -> Self
Source§impl<'a, T, BH> IntoIterator for &'a FzStringSet<T, BH>
impl<'a, T, BH> IntoIterator for &'a FzStringSet<T, BH>
Source§impl<T, BH> IntoIterator for FzStringSet<T, BH>
impl<T, BH> IntoIterator for FzStringSet<T, BH>
Source§impl<T, BH> Len for FzStringSet<T, BH>
impl<T, BH> Len for FzStringSet<T, BH>
Source§impl<T, ST, BH> PartialEq<ST> for FzStringSet<T, BH>
impl<T, ST, BH> PartialEq<ST> for FzStringSet<T, BH>
Source§impl<T, BH> Serialize for FzStringSet<T, BH>where
T: Serialize,
Available on crate feature serde only.
impl<T, BH> Serialize for FzStringSet<T, BH>where
T: Serialize,
serde only.Source§impl<T, Q, BH> SetExtras<T, Q> for FzStringSet<T, BH>
impl<T, Q, BH> SetExtras<T, Q> for FzStringSet<T, BH>
Source§impl<T, BH> SetIteration<T> for FzStringSet<T, BH>
impl<T, BH> SetIteration<T> for FzStringSet<T, BH>
Source§impl<T, Q, BH> SetQuery<Q> for FzStringSet<T, BH>
impl<T, Q, BH> SetQuery<Q> for FzStringSet<T, BH>
Source§impl<T, ST, BH> Sub<&ST> for &FzStringSet<T, BH>
impl<T, ST, BH> Sub<&ST> for &FzStringSet<T, BH>
impl<T, BH> Eq for FzStringSet<T, BH>
impl<T, Q, BH> Set<T, Q> for FzStringSet<T, BH>
Auto Trait Implementations§
impl<T, BH> Freeze for FzStringSet<T, BH>
impl<T, BH> RefUnwindSafe for FzStringSet<T, BH>where
BH: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, BH> Send for FzStringSet<T, BH>
impl<T, BH> Sync for FzStringSet<T, BH>
impl<T, BH> Unpin for FzStringSet<T, BH>where
BH: Unpin,
impl<T, BH> UnsafeUnpin for FzStringSet<T, BH>
impl<T, BH> UnwindSafe for FzStringSet<T, BH>where
BH: UnwindSafe,
T: UnwindSafe,
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
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<ST, T> SetOps<T> for STwhere
ST: Set<T>,
impl<ST, T> SetOps<T> for STwhere
ST: Set<T>,
Source§fn union<'a, ST>(&'a self, other: &'a ST) -> Union<'a, Self, ST, T> ⓘ
fn union<'a, ST>(&'a self, other: &'a ST) -> Union<'a, Self, ST, T> ⓘ
self or other, without duplicates.Source§fn symmetric_difference<'a, ST>(
&'a self,
other: &'a ST,
) -> SymmetricDifference<'a, Self, ST, T> ⓘ
fn symmetric_difference<'a, ST>( &'a self, other: &'a ST, ) -> SymmetricDifference<'a, Self, ST, T> ⓘ
self or in other but not in both.Source§fn difference<'a, ST>(&'a self, other: &'a ST) -> Difference<'a, Self, ST, T> ⓘ
fn difference<'a, ST>(&'a self, other: &'a ST) -> Difference<'a, Self, ST, T> ⓘ
self but not in other.Source§fn intersection<'a, ST>(
&'a self,
other: &'a ST,
) -> Intersection<'a, Self, ST, T> ⓘ
fn intersection<'a, ST>( &'a self, other: &'a ST, ) -> Intersection<'a, Self, ST, T> ⓘ
self and other. Read moreSource§fn is_disjoint<'a, ST>(&'a self, other: &'a ST) -> bool
fn is_disjoint<'a, ST>(&'a self, other: &'a ST) -> bool
true if self has no entries in common with other.
This is equivalent to checking for an empty intersection.