Initial commit
This commit is contained in:
commit
85b08fe00b
29 changed files with 750 additions and 0 deletions
22
crates/std/src/arena/intern/hasher.rs
Normal file
22
crates/std/src/arena/intern/hasher.rs
Normal file
|
@ -0,0 +1,22 @@
|
|||
use std::hash::Hasher;
|
||||
|
||||
#[derive(Default, Clone, Copy, PartialEq, Eq)]
|
||||
pub struct NoHash(Option<u64>);
|
||||
|
||||
impl Hasher for NoHash {
|
||||
fn write_u64(&mut self, i: u64) {
|
||||
if self.0.is_some() {
|
||||
panic!("called write_u64 twice")
|
||||
} else {
|
||||
self.0 = Some(i);
|
||||
}
|
||||
}
|
||||
|
||||
fn write(&mut self, _: &[u8]) {
|
||||
unreachable!()
|
||||
}
|
||||
|
||||
fn finish(&self) -> u64 {
|
||||
self.0.unwrap()
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue