#![deny(missing_docs, rust_2018_idioms)]
#![forbid(unsafe_code)]
use git_hash::ObjectId;
pub use hashbrown::{hash_map, hash_set, raw, Equivalent};
pub mod hash {
#[derive(Default, Clone, Copy)]
pub struct Hasher(u64);
impl std::hash::Hasher for Hasher {
fn finish(&self) -> u64 {
self.0
}
#[inline(always)]
fn write(&mut self, bytes: &[u8]) {
self.0 = u64::from_ne_bytes(bytes[..8].try_into().unwrap());
}
}
#[derive(Default, Clone, Copy)]
pub struct Builder;
impl std::hash::BuildHasher for Builder {
type Hasher = Hasher;
fn build_hasher(&self) -> Self::Hasher {
Hasher::default()
}
}
}
pub type HashMap<K, V> = hashbrown::HashMap<K, V, hash::Builder>;
pub type HashSet<T = ObjectId> = hashbrown::HashSet<T, hash::Builder>;