Unusual conflict, no apparent commits from another machine. Resolved formatting. Using HEAD.
This commit is contained in:
commit
d45e9bd270
1 changed files with 6 additions and 28 deletions
22
src/map.rs
22
src/map.rs
|
|
@ -263,27 +263,6 @@ impl<E: TableEntry> DisplacementSet<E> {
|
|||
}
|
||||
}
|
||||
}
|
||||
pub fn get<K>(&mut self, index: K) -> Option<&E>
|
||||
where
|
||||
E: Equivalent<K>,
|
||||
K: Hashes,
|
||||
{
|
||||
if self.map.len() == 0 {
|
||||
return None;
|
||||
}
|
||||
let location = index.hashed() as usize % self.map.len();
|
||||
let home = &self.map[location];
|
||||
if home.entry.matches(&index) {
|
||||
Some(&home.entry)
|
||||
} else {
|
||||
for i in 1..home.displacement as usize {
|
||||
let neighbour = &self.map[(location + i) % self.map.len()];
|
||||
if neighbour.entry.matches(&index) {
|
||||
return Some(&neighbour.entry);
|
||||
}
|
||||
}
|
||||
None
|
||||
}
|
||||
}
|
||||
pub fn new() -> DisplacementSet<E> {
|
||||
DisplacementSet {
|
||||
|
|
@ -292,7 +271,6 @@ impl<E: TableEntry> DisplacementSet<E> {
|
|||
map_bounds: (0..0).into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct MapEntry<K: Hashes + PartialEq, V>(pub Option<(K, V)>);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue