osom_lib_hash_tables/abseil/
configuration.rs1use core::hash::BuildHasher;
4use core::hash::Hash;
5
6use osom_lib_alloc::traits::Allocator;
7
8use crate::helpers::MaxLoadFactor;
9
10pub trait AbseilConfig: Sized {
12 type ConcreteBuildHasher: BuildHasher;
13 type ConcreteAllocator: Allocator;
14
15 fn build_hasher(&self) -> &Self::ConcreteBuildHasher;
16 fn allocator_mut(&mut self) -> &mut Self::ConcreteAllocator;
17 fn load_factor(&self) -> MaxLoadFactor;
18 fn calculate_partial_hashes<T: Hash>(&self, value: T) -> (u64, u8) {
19 let hash_value = self.build_hasher().hash_one(value);
20 let h1 = hash_value >> 7;
21 let h2 = (hash_value & 0x7f) as u8;
22 (h1, h2)
23 }
24}