Trait metrics_util::Hashable[][src]

pub trait Hashable: Hash {
    fn hashable(&self) -> u64;
}
Expand description

A type that can hash itself.

In high-performance use cases, an object can pre-hash itself, or memoize its hash value, when it is anticipated that an object will be hashed multiple times. Rather than the standard library Hash trait, Hashable exposes an interface that forces objects to hash themselves entirely, providing only the resulting 8-byte hash.

For all implementations of Hashable, you must utilize metrics::KeyHasher. Usage of another hasher will lead to inconsistency in places where Hashable is used, specifically Registry. You can wrap items in DefaultHashable to ensure they utilize the correct hasher.

Required methods

fn hashable(&self) -> u64[src]

Generate the hash of this object.

Implementations on Foreign Types

impl Hashable for Key[src]

fn hashable(&self) -> u64[src]

Implementors