summaryrefslogtreecommitdiffstats
path: root/core/src/hasher.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2019-09-10 19:41:49 +0200
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2019-09-10 19:41:49 +0200
commit8b8f7563ad33dafeadf6238e377748cdec17d67a (patch)
tree45a601d18a054ccdd068eeac93730e4e99252158 /core/src/hasher.rs
parent2913c64da3452d1fbf92384e4ff32c278fb383f8 (diff)
downloadiced-8b8f7563ad33dafeadf6238e377748cdec17d67a.tar.gz
iced-8b8f7563ad33dafeadf6238e377748cdec17d67a.tar.bz2
iced-8b8f7563ad33dafeadf6238e377748cdec17d67a.zip
Switch to workspace layout
Diffstat (limited to 'core/src/hasher.rs')
-rw-r--r--core/src/hasher.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/core/src/hasher.rs b/core/src/hasher.rs
new file mode 100644
index 00000000..9f6aacce
--- /dev/null
+++ b/core/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()
+ }
+}