diff options
author | 2019-09-14 19:16:06 +0200 | |
---|---|---|
committer | 2019-09-14 19:16:06 +0200 | |
commit | a97401aed2a173260a4abfdb65a77975ce6c0f01 (patch) | |
tree | ca85ba2e078ddfeee8e74abd4eaae7c25b031cb2 /src/hasher.rs | |
parent | 8b8f7563ad33dafeadf6238e377748cdec17d67a (diff) | |
download | iced-a97401aed2a173260a4abfdb65a77975ce6c0f01.tar.gz iced-a97401aed2a173260a4abfdb65a77975ce6c0f01.tar.bz2 iced-a97401aed2a173260a4abfdb65a77975ce6c0f01.zip |
Rethink workspace structure
Diffstat (limited to 'src/hasher.rs')
-rw-r--r-- | src/hasher.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/hasher.rs b/src/hasher.rs new file mode 100644 index 00000000..9f6aacce --- /dev/null +++ b/src/hasher.rs @@ -0,0 +1,19 @@ +/// The hasher used to compare layouts. +#[derive(Debug)] +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() + } +} |