rustc_data_structures/
unhash.rs1use std::collections::{HashMap, HashSet};
2use std::hash::{BuildHasherDefault, Hasher};
3
4pub type UnhashMap<K, V> = HashMap<K, V, BuildHasherDefault<Unhasher>>;
5pub type UnhashSet<V> = HashSet<V, BuildHasherDefault<Unhasher>>;
6pub type UnindexMap<K, V> = indexmap::IndexMap<K, V, BuildHasherDefault<Unhasher>>;
7
8#[derive(#[automatically_derived]
impl ::core::default::Default for Unhasher {
#[inline]
fn default() -> Unhasher {
Unhasher { value: ::core::default::Default::default() }
}
}Default)]
11pub struct Unhasher {
12 value: u64,
13}
14
15impl Hasher for Unhasher {
16 #[inline]
17 fn finish(&self) -> u64 {
18 self.value
19 }
20
21 fn write(&mut self, _bytes: &[u8]) {
22 {
::core::panicking::panic_fmt(format_args!("not implemented: {0}",
format_args!("use write_u64")));
};unimplemented!("use write_u64");
23 }
24
25 #[inline]
26 fn write_u64(&mut self, value: u64) {
27 if true {
match (&0, &self.value) {
(left_val, right_val) => {
if !(*left_val == *right_val) {
let kind = ::core::panicking::AssertKind::Eq;
::core::panicking::assert_failed(kind, &*left_val,
&*right_val,
::core::option::Option::Some(format_args!("Unhasher doesn\'t mix values!")));
}
}
};
};debug_assert_eq!(0, self.value, "Unhasher doesn't mix values!");
28 self.value = value;
29 }
30}