glossa_shared/
phf_tuple_key.rs1use core::hash::{Hash, Hasher};
2
3use phf_shared::{FmtConst, PhfBorrow, PhfHash};
4
5#[derive(Default, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, Clone, Copy)]
6pub struct PhfTupleKey<'a>(pub &'a str, pub &'a str);
7
8impl PhfHash for PhfTupleKey<'_> {
9 fn phf_hash<H: Hasher>(&self, state: &mut H) {
10 self.0.hash(state);
11 self.1.hash(state);
12 }
13}
14
15impl PhfBorrow<Self> for PhfTupleKey<'_> {
21 fn borrow(&self) -> &Self {
22 self
23 }
24}
25
26impl FmtConst for PhfTupleKey<'_> {
27 fn fmt_const(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
28 let Self(map, key) = self;
29 write!(f, r###"Key(r#"{map}"#, r##"{key}"##)"###)
30 }
31}