turbo_trace_server/
string_tuple_ref.rs1use hashbrown::Equivalent;
2
3#[derive(Hash)]
4pub struct StringTupleRef<'a>(pub &'a str, pub &'a str);
5
6impl<'a> Equivalent<(String, String)> for StringTupleRef<'a> {
7 fn equivalent(&self, other: &(String, String)) -> bool {
8 self.0 == other.0 && self.1 == other.1
9 }
10}
11
12#[cfg(test)]
13mod string_tuple_ref_tests {
14 use std::hash::RandomState;
15
16 use super::*;
17
18 #[test]
19 fn test_string_tuple_ref_hash() {
20 use std::hash::BuildHasher;
21
22 let s = RandomState::new();
23 assert_eq!(
24 s.hash_one(StringTupleRef("abc", "def")),
25 s.hash_one(&("abc".to_string(), "def".to_string()))
26 );
27 }
28}