pub struct Hasher { /* private fields */ }Expand description
Hasher is used to calculate a token’s hash value.
The hash state is encapsulated in the Hasher to allow the hashing of
multi-part strings where the concatenated value can not be know at macro
expansion time. All functions are const.
Implementations§
Source§impl Hasher
impl Hasher
Sourcepub const fn new(data_len: usize, hash_len: usize) -> Self
pub const fn new(data_len: usize, hash_len: usize) -> Self
Create a new Hasher
data_len is the total length of the data to be hashed. hash_len
is the number of bytes of data to be used in calculating the hash.
data_len is used to seed the hash while hash_len controls how many
bytes are hashed.
Sourcepub const fn process_bytes(self, bytes: &[u8]) -> Self
pub const fn process_bytes(self, bytes: &[u8]) -> Self
Processes bytes and updates hash state.
Consumes self and returns a Hasher with the updated state.
Auto Trait Implementations§
impl Freeze for Hasher
impl RefUnwindSafe for Hasher
impl Send for Hasher
impl Sync for Hasher
impl Unpin for Hasher
impl UnwindSafe for Hasher
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