Struct BuildHasherDefault
pub struct BuildHasherDefault<H>(pub(in ::hash) PhantomData<fn() -> H>);
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 HashMap;
use ;
;
type MyBuildHasher = ;
let hash_map = default;
Fields
0: PhantomData<fn() -> H>
Implementations
impl<H> BuildHasherDefault<H>
const fn new() -> SelfCreates a new BuildHasherDefault for Hasher
H.
Trait Implementations
impl<H> Clone for BuildHasherDefault<H>
fn clone(&self) -> BuildHasherDefault<H>
impl<H> Debug for BuildHasherDefault<H>
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl<H> Default for BuildHasherDefault<H>
fn default() -> BuildHasherDefault<H>
impl<H> Eq for BuildHasherDefault<H>
impl<H> PartialEq for BuildHasherDefault<H>
fn eq(&self, _other: &BuildHasherDefault<H>) -> bool
impl<H: Default + Hasher> BuildHasher for BuildHasherDefault<H>
type Hasher = H;fn build_hasher(&self) -> H
Auto Trait Implementations
impl<H> Freeze for BuildHasherDefault<H>
where
PhantomData<fn() -> H>: Freeze,
impl<H> RefUnwindSafe for BuildHasherDefault<H>
where
PhantomData<fn() -> H>: RefUnwindSafe,
impl<H> Send for BuildHasherDefault<H>
where
PhantomData<fn() -> H>: Send,
impl<H> Sync for BuildHasherDefault<H>
where
PhantomData<fn() -> H>: Sync,
impl<H> Unpin for BuildHasherDefault<H>
where
PhantomData<fn() -> H>: Unpin,
impl<H> UnsafeUnpin for BuildHasherDefault<H>
where
PhantomData<fn() -> H>: UnsafeUnpin,
impl<H> UnwindSafe for BuildHasherDefault<H>
where
PhantomData<fn() -> H>: UnwindSafe,
Blanket Implementations
impl<T> Any for BuildHasherDefault<H>
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for BuildHasherDefault<H>
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for BuildHasherDefault<H>
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for BuildHasherDefault<H>
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for BuildHasherDefault<H>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> SizeHint for BuildHasherDefault<H>
where
T: ?Sized,
fn lower_bound(&self) -> usizefn upper_bound(&self) -> Option<usize>
impl<T> SizedTypeProperties for BuildHasherDefault<H>
impl<T, U> Into<U> for BuildHasherDefault<H>
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for BuildHasherDefault<H>
where
U: Into<T>,
type Error = Infallible;fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto<U> for BuildHasherDefault<H>
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>