pub struct SumHashes<C: ProvidesHasher>(/* private fields */);Expand description
Adds hashing to any collection according to the hash of each element, but without
respecting iteration order. Instantly usable with HashMap or HashSet. Deref and
DerefMut provide access to the wrapped type. To create, use the new method or From.
use hash_that_set::SumHashes;
let my_map: HashMap<i8, String> = HashMap::new();
let mut my_map = SumHashes::new(my_map);
my_map.insert(2, String::from("hello"));This may be used with any collection, although it requires the wrapped collection to implement
ProvidesHasher.
The layout of this struct is guaranteed to be the same as the wrapped collection. This means
it is possible to transmute references; however, hash_by_summing_hashes is usually a better
option than relying on unsafe.
Implementations§
Source§impl<C: ProvidesHasher> SumHashes<C>
impl<C: ProvidesHasher> SumHashes<C>
Sourcepub fn into_inner(self) -> C
pub fn into_inner(self) -> C
Destructures into the inner collection
Trait Implementations§
Source§impl<C: ProvidesHasher> Deref for SumHashes<C>
impl<C: ProvidesHasher> Deref for SumHashes<C>
Source§impl<C: ProvidesHasher> DerefMut for SumHashes<C>
impl<C: ProvidesHasher> DerefMut for SumHashes<C>
Source§impl<C: ProvidesHasher> From<C> for SumHashes<C>
impl<C: ProvidesHasher> From<C> for SumHashes<C>
Source§impl<C: ProvidesHasher> Hash for SumHashes<C>
impl<C: ProvidesHasher> Hash for SumHashes<C>
Source§impl<C: ProvidesHasher + IntoIterator> IntoIterator for SumHashes<C>
impl<C: ProvidesHasher + IntoIterator> IntoIterator for SumHashes<C>
impl<C: Eq + ProvidesHasher> Eq for SumHashes<C>
impl<C: ProvidesHasher> StructuralPartialEq for SumHashes<C>
Auto Trait Implementations§
impl<C> Freeze for SumHashes<C>where
C: Freeze,
impl<C> RefUnwindSafe for SumHashes<C>where
C: RefUnwindSafe,
impl<C> Send for SumHashes<C>where
C: Send,
impl<C> Sync for SumHashes<C>where
C: Sync,
impl<C> Unpin for SumHashes<C>where
C: Unpin,
impl<C> UnwindSafe for SumHashes<C>where
C: 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
Mutably borrows from an owned value. Read more