diff options
author | 2019-08-30 01:54:41 +0200 | |
---|---|---|
committer | 2019-08-30 01:54:41 +0200 | |
commit | 2ebe09dacb12d1d0c02acbd55e2387b052616f47 (patch) | |
tree | 743e00dc6a33a7441f6357bf0d47c2a683183dbb /src/hasher.rs | |
parent | e84e0b876c3c9547f5758c72f1cb971fdba71483 (diff) | |
download | iced-2ebe09dacb12d1d0c02acbd55e2387b052616f47.tar.gz iced-2ebe09dacb12d1d0c02acbd55e2387b052616f47.tar.bz2 iced-2ebe09dacb12d1d0c02acbd55e2387b052616f47.zip |
Make `Hasher` opaque
Diffstat (limited to 'src/hasher.rs')
-rw-r--r-- | src/hasher.rs | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/hasher.rs b/src/hasher.rs index a930fa13..2aa10336 100644 --- a/src/hasher.rs +++ b/src/hasher.rs @@ -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() + } +} |