Make Hasher opaque

This commit is contained in:
Héctor Ramón Jiménez 2019-08-30 01:54:41 +02:00
parent e84e0b876c
commit 2ebe09dacb
12 changed files with 36 additions and 20 deletions

View file

@ -1,2 +1,18 @@
/// The hasher used to compare layouts.
pub type Hasher = twox_hash::XxHash;
pub struct Hasher(twox_hash::XxHash64);
impl Default for Hasher {
fn default() -> Self {
Hasher(twox_hash::XxHash64::default())
}
}
impl core::hash::Hasher for Hasher {
fn write(&mut self, bytes: &[u8]) {
self.0.write(bytes)
}
fn finish(&self) -> u64 {
self.0.finish()
}
}