Struct rustc_data_structures::stable_hasher::StableHasher
[−]
[src]
pub struct StableHasher<W> { /* fields omitted */ }
rustc_private
)When hashing something that ends up affecting properties like symbol names. We want these symbol names to be calculated independent of other factors like what architecture you're compiling from.
The hashing just uses the standard Hash
trait, but the implementations of
Hash
for the usize
and isize
types are not architecture independent
(e.g. they has 4 or 8 bytes). As a result we want to avoid usize
and
isize
completely when hashing.
To do that, we encode all integers to be hashed with some arch-independent encoding.
At the moment, we pass i8/u8 straight through and encode all other integers using leb128.
This hasher currently always uses the stable Blake2b algorithm and allows for variable output lengths through its type parameter.
Methods
impl<W: StableHasherResult> StableHasher<W>
[src]
fn new() -> Self
rustc_private
)fn finish(self) -> W
rustc_private
)impl<W> StableHasher<W>
[src]
fn finalize(&mut self) -> &[u8]
rustc_private
)fn bytes_hashed(&self) -> u64
rustc_private
)Trait Implementations
impl<W: Debug> Debug for StableHasher<W>
[src]
impl<W> Hasher for StableHasher<W>
[src]
fn finish(&self) -> u64
Completes a round of hashing, producing the output hash generated.
fn write(&mut self, bytes: &[u8])
Writes some data into this Hasher
.
fn write_u8(&mut self, i: u8)
Write a single u8
into this hasher.
fn write_u16(&mut self, i: u16)
Writes a single u16
into this hasher.
fn write_u32(&mut self, i: u32)
Writes a single u32
into this hasher.
fn write_u64(&mut self, i: u64)
Writes a single u64
into this hasher.
fn write_usize(&mut self, i: usize)
Writes a single usize
into this hasher.
fn write_i8(&mut self, i: i8)
Writes a single i8
into this hasher.
fn write_i16(&mut self, i: i16)
Writes a single i16
into this hasher.
fn write_i32(&mut self, i: i32)
Writes a single i32
into this hasher.
fn write_i64(&mut self, i: i64)
Writes a single i64
into this hasher.
fn write_isize(&mut self, i: isize)
Writes a single isize
into this hasher.
fn write_u128(&mut self, i: u128)
i128
)Writes a single u128
into this hasher.
fn write_i128(&mut self, i: i128)
i128
)Writes a single i128
into this hasher.