Struct rustc_data_structures::stable_hasher::StableHasher [] [src]

pub struct StableHasher<W> { /* fields omitted */ }
🔬 This is a nightly-only experimental API. (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]

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

impl<W> StableHasher<W>
[src]

🔬 This is a nightly-only experimental API. (rustc_private)

🔬 This is a nightly-only experimental API. (rustc_private)

Trait Implementations

impl<W: Debug> Debug for StableHasher<W>
[src]

Formats the value using the given formatter.

impl<W> Hasher for StableHasher<W>
[src]

Completes a round of hashing, producing the output hash generated.

Writes some data into this Hasher.

Write a single u8 into this hasher.

Writes a single u16 into this hasher.

Writes a single u32 into this hasher.

Writes a single u64 into this hasher.

Writes a single usize into this hasher.

Writes a single i8 into this hasher.

Writes a single i16 into this hasher.

Writes a single i32 into this hasher.

Writes a single i64 into this hasher.

Writes a single isize into this hasher.

🔬 This is a nightly-only experimental API. (i128)

Writes a single u128 into this hasher.

🔬 This is a nightly-only experimental API. (i128)

Writes a single i128 into this hasher.