2019-07-20 19:12:31 +02:00
|
|
|
/// The hasher used to compare layouts.
|
2019-08-31 06:20:56 +02:00
|
|
|
#[derive(Debug)]
|
2019-08-30 01:54:41 +02:00
|
|
|
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()
|
|
|
|
|
}
|
|
|
|
|
}
|