[][src]Struct refset::HashRefSet

pub struct HashRefSet<T: ?Sized>(_, _);

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

impl<T: ?Sized + Hash> HashRefSet<T>[src]

pub fn new() -> Self[src]

Create a new empty HashRefSet

pub fn into_inner(self) -> HashSet<HashType>[src]

Consume into the inner HashSet.

pub fn with_capacity(cap: usize) -> Self[src]

Create a new HashRefSet with a capacity

pub fn insert<Q: ?Sized>(&mut self, value: &Q) -> bool where
    Q: Borrow<T>, 
[src]

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.

pub fn remove<Q: ?Sized>(&mut self, value: &Q) -> bool where
    Q: Borrow<T>, 
[src]

Remove a reference from the set.

Returns true if it existed.

pub fn contains<Q: ?Sized>(&mut self, value: &Q) -> bool where
    Q: Borrow<T>, 
[src]

Check if this value has been inserted into the set.

pub fn len(&self) -> usize[src]

The number of items stored in the set

pub fn is_empty(&self) -> bool[src]

Is the set empty

pub fn hashes_iter(&self) -> Iter<'_, HashType>[src]

An iterator over the hashes stored in the set.

Trait Implementations

impl<T: Clone + ?Sized> Clone for HashRefSet<T>[src]

impl<T: Debug + ?Sized> Debug for HashRefSet<T>[src]

impl<T: Default + ?Sized> Default for HashRefSet<T>[src]

impl<T: Eq + ?Sized> Eq for HashRefSet<T>[src]

impl<T: ?Sized + Hash> IntoIterator for HashRefSet<T>[src]

type Item = HashType

The type of the elements being iterated over.

type IntoIter = IntoIter<HashType>

Which kind of iterator are we turning this into?

impl<T: PartialEq + ?Sized> PartialEq<HashRefSet<T>> for HashRefSet<T>[src]

impl<T: ?Sized + Send> Send for HashRefSet<T>[src]

impl<T: ?Sized> StructuralEq for HashRefSet<T>[src]

impl<T: ?Sized> StructuralPartialEq for HashRefSet<T>[src]

impl<T: ?Sized + Send + Sync> Sync for HashRefSet<T>[src]

Auto Trait Implementations

impl<T: ?Sized> RefUnwindSafe for HashRefSet<T> where
    T: RefUnwindSafe

impl<T: ?Sized> Unpin for HashRefSet<T>

impl<T: ?Sized> UnwindSafe for HashRefSet<T> where
    T: RefUnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.