Struct wasmer_types::lib::std::hash::BuildHasherDefault 1.7.0[−][src]
pub struct BuildHasherDefault<H>(_);
Expand description
Used to create a default BuildHasher
instance for types that implement
Hasher
and Default
.
BuildHasherDefault<H>
can be used when a type H
implements Hasher
and
Default
, and you need a corresponding BuildHasher
instance, but none is
defined.
Any BuildHasherDefault
is zero-sized. It can be created with
default
. When using BuildHasherDefault
with HashMap
or
HashSet
, this doesn’t need to be done, since they implement appropriate
Default
instances themselves.
Examples
Using BuildHasherDefault
to specify a custom BuildHasher
for
HashMap
:
use std::collections::HashMap; use std::hash::{BuildHasherDefault, Hasher}; #[derive(Default)] struct MyHasher; impl Hasher for MyHasher { fn write(&mut self, bytes: &[u8]) { // Your hashing algorithm goes here! unimplemented!() } fn finish(&self) -> u64 { // Your hashing algorithm goes here! unimplemented!() } } type MyBuildHasher = BuildHasherDefault<MyHasher>; let hash_map = HashMap::<u32, u32, MyBuildHasher>::default();
Trait Implementations
impl<H> BuildHasher for BuildHasherDefault<H> where
H: Default + Hasher,
[src]
impl<H> BuildHasher for BuildHasherDefault<H> where
H: Default + Hasher,
[src]type Hasher = H
type Hasher = H
Type of the hasher that will be created.
pub fn build_hasher(&self) -> H
[src]
pub fn build_hasher(&self) -> H
[src]Creates a new hasher. Read more
impl<H> Clone for BuildHasherDefault<H>
[src]
impl<H> Clone for BuildHasherDefault<H>
[src]pub fn clone(&self) -> BuildHasherDefault<H>
[src]
pub fn clone(&self) -> BuildHasherDefault<H>
[src]Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]Performs copy-assignment from source
. Read more
impl<H> Debug for BuildHasherDefault<H>
1.9.0[src]
impl<H> Debug for BuildHasherDefault<H>
1.9.0[src]impl<H> Default for BuildHasherDefault<H>
[src]
impl<H> Default for BuildHasherDefault<H>
[src]pub fn default() -> BuildHasherDefault<H>
[src]
pub fn default() -> BuildHasherDefault<H>
[src]Returns the “default value” for a type. Read more
impl<H> PartialEq<BuildHasherDefault<H>> for BuildHasherDefault<H>
1.29.0[src]
impl<H> PartialEq<BuildHasherDefault<H>> for BuildHasherDefault<H>
1.29.0[src]impl<H> Eq for BuildHasherDefault<H>
1.29.0[src]
Auto Trait Implementations
impl<H> RefUnwindSafe for BuildHasherDefault<H> where
H: RefUnwindSafe,
H: RefUnwindSafe,
impl<H> Send for BuildHasherDefault<H> where
H: Send,
H: Send,
impl<H> Sync for BuildHasherDefault<H> where
H: Sync,
H: Sync,
impl<H> Unpin for BuildHasherDefault<H> where
H: Unpin,
H: Unpin,
impl<H> UnwindSafe for BuildHasherDefault<H> where
H: UnwindSafe,
H: UnwindSafe,
Blanket Implementations
impl<T> ArchivePointee for T
[src]
impl<T> ArchivePointee for T
[src]type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
pub fn pointer_metadata(
&<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
[src]
pub fn pointer_metadata(
&<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
[src]Converts some archived metadata to the pointer metadata for itself.
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]pub fn equivalent(&self, key: &K) -> bool
[src]
pub fn equivalent(&self, key: &K) -> bool
[src]Compare self to key
and return true
if they are equal.
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more