summaryrefslogtreecommitdiffstats
path: root/web/src/hasher.rs
blob: 1a28a2f95e49a8b31593b09d19e992e77b96c822 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
use std::collections::hash_map::DefaultHasher;

/// The hasher used to compare subscriptions.
#[derive(Debug)]
pub struct Hasher(DefaultHasher);

impl Default for Hasher {
    fn default() -> Self {
        Hasher(DefaultHasher::default())
    }
}

impl core::hash::Hasher for Hasher {
    fn write(&mut self, bytes: &[u8]) {
        self.0.write(bytes)
    }

    fn finish(&self) -> u64 {
        self.0.finish()
    }
}