Struct FxHasher
pub(in ::bridge) struct FxHasher { pub(in ::bridge::fxhash) hash: usize }
A speedy hash algorithm for use within rustc. The hashmap in alloc by default uses SipHash which isn't quite as speedy as we want. In the compiler we're not really worried about DOS attempts, so we use a fast non-cryptographic hash.
This is the same as the algorithm used by Firefox -- which is a homespun one not based on any widely-known algorithm -- though modified to produce 64-bit hash values instead of 32-bit hash values. It consistently out-performs an FNV-based hash within rustc itself -- the collision rate is similar or slightly worse than FNV, but the speed of the hash function itself is much higher because it works on up to 8 bytes at a time.
Fields
hash: usize
Implementations
impl FxHasher
fn add_to_hash(&mut self, i: usize)
Trait Implementations
impl Default for FxHasher
fn default() -> FxHasher
impl Hasher for FxHasher
fn write(&mut self, bytes: &[u8])fn write_u8(&mut self, i: u8)fn write_u16(&mut self, i: u16)fn write_u32(&mut self, i: u32)fn write_u64(&mut self, i: u64)fn write_usize(&mut self, i: usize)fn finish(&self) -> u64
Auto Trait Implementations
impl Freeze for FxHasher
impl RefUnwindSafe for FxHasher
impl Send for FxHasher
impl Sync for FxHasher
impl Unpin for FxHasher
impl UnsafeUnpin for FxHasher
impl UnwindSafe for FxHasher
Blanket Implementations
impl<T> Any for FxHasher
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for FxHasher
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for FxHasher
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> From<T> for FxHasher
fn from(t: T) -> TReturns the argument unchanged.
impl<T> SizeHint for FxHasher
where
T: ?Sized,
fn lower_bound(&self) -> usizefn upper_bound(&self) -> Option<usize>
impl<T> SizedTypeProperties for FxHasher
impl<T, U> Into<U> for FxHasher
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 FxHasher
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for FxHasher
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>