Small tweaks
This commit is contained in:
parent
d037e22164
commit
f3922ff84d
7 changed files with 182 additions and 23 deletions
|
|
@ -45,11 +45,18 @@ pub trait Hashes {
|
|||
impl Hashes for &str {
|
||||
fn hashed(&self) -> Hashed {
|
||||
let mut hasher = DefaultHasher::new();
|
||||
self[..self.len().min(6)].hash(&mut hasher);
|
||||
self[..self.len().min(8)].hash(&mut hasher);
|
||||
hasher.finish() as Hashed
|
||||
}
|
||||
}
|
||||
|
||||
impl Hashes for String {
|
||||
fn hashed(&self) -> Hashed {
|
||||
self.as_str().hashed()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pub trait TableEntry: Equivalent<Self> + Hashes {
|
||||
const VACANT: Self;
|
||||
fn is_vacant(&self) -> bool;
|
||||
|
|
@ -58,8 +65,8 @@ pub trait TableEntry: Equivalent<Self> + Hashes {
|
|||
#[derive(Debug)]
|
||||
pub struct Entry<E: TableEntry> {
|
||||
pub entry: E,
|
||||
home: usize,
|
||||
displacement: Displacement,
|
||||
pub home: usize,
|
||||
pub displacement: Displacement,
|
||||
}
|
||||
|
||||
impl<E: TableEntry> Entry<E> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue