pub struct HashRefSet<T: ?Sized>(/* private fields */);
Expand description
A hash-set of references to an item.
Instead of inserting the item into the set, the set is “marked” with the item. Think of this as inserting a reference into the set with no lifetime.
Any type that can borrow to T
can be used to insert, and neither type needs to be Sized
.
T
need only implement Hash
.
§Hashing algorithm
The hasing algorithm used is Sha512
, which is rather large (64 bytes).
At present there is no way to change the hasher used, I might implement that functionality in the future.
Implementations§
Source§impl<T: ?Sized + Hash> HashRefSet<T>
impl<T: ?Sized + Hash> HashRefSet<T>
Sourcepub fn into_inner(self) -> HashSet<HashType>
pub fn into_inner(self) -> HashSet<HashType>
Consume into the inner HashSet
.
Sourcepub fn with_capacity(cap: usize) -> Self
pub fn with_capacity(cap: usize) -> Self
Create a new HashRefSet
with a capacity
Sourcepub fn insert<Q>(&mut self, value: &Q) -> bool
pub fn insert<Q>(&mut self, value: &Q) -> bool
Insert a reference into the set. The reference can be any type that borrows to T
.
Returns true
if there was no previous item, false
if there was.
Sourcepub fn remove<Q>(&mut self, value: &Q) -> bool
pub fn remove<Q>(&mut self, value: &Q) -> bool
Remove a reference from the set.
Returns true
if it existed.
Sourcepub fn contains<Q>(&mut self, value: &Q) -> bool
pub fn contains<Q>(&mut self, value: &Q) -> bool
Check if this value has been inserted into the set.
Sourcepub fn hashes_iter(&self) -> Iter<'_, HashType>
pub fn hashes_iter(&self) -> Iter<'_, HashType>
An iterator over the hashes stored in the set.
Trait Implementations§
Source§impl<T: Clone + ?Sized> Clone for HashRefSet<T>
impl<T: Clone + ?Sized> Clone for HashRefSet<T>
Source§fn clone(&self) -> HashRefSet<T>
fn clone(&self) -> HashRefSet<T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more