Struct AHasher
pub struct AHasher { /* private fields */ }
A Hasher for hashing an arbitrary stream of bytes.
Instances of AHasher represent state that is updated while hashing data.
Each method updates the internal state based on the new data provided. Once
all of the data has been provided, the resulting hash can be obtained by calling
finish()
[Clone] is also provided in case you wish to calculate hashes for two different items that start with the same data.
Trait Implementations
impl Clone for AHasher
fn clone(&self) -> AHasher
impl Debug for AHasher
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Default for AHasher
fn default() -> AHasherConstructs a new [AHasher] with fixed keys. If
stdis enabled these will be generated upon first invocation. Otherwise if thecompile-time-rngfeature is enabled these will be generated at compile time. If neither of these features are available, hardcoded constants will be used.Because the values are fixed, different hashers will all hash elements the same way. This could make hash values predictable, if DOS attacks are a concern. If this behaviour is not required, it may be preferable to use [RandomState] instead.
Examples
use AHasher; use Hasher; let mut hasher_1 = default; let mut hasher_2 = default; hasher_1.write_u32; hasher_2.write_u32; assert_eq!;
impl Hasher for AHasher
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_u128(&mut self, i: u128)fn write_usize(&mut self, i: usize)fn write(&mut self, input: &[u8])fn finish(&self) -> u64
Auto Trait Implementations
impl Freeze for AHasher
impl RefUnwindSafe for AHasher
impl Send for AHasher
impl Sync for AHasher
impl Unpin for AHasher
impl UnsafeUnpin for AHasher
impl UnwindSafe for AHasher
Blanket Implementations
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for AHasher
where
ST: ?Sized,
DT: ?Sized,
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for AHasher
where
ST: ?Sized,
DT: ?Sized,
impl<T> Any for AHasher
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for AHasher
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for AHasher
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for AHasher
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for AHasher
fn from(t: T) -> TReturns the argument unchanged.
impl<T> Read<Exclusive, BecauseExclusive> for AHasher
where
T: ?Sized,
impl<T> ToOwned for AHasher
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T, U> Into<U> for AHasher
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 AHasher
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for AHasher
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>