Struct boomphf::Mphf
[−]
[src]
pub struct Mphf<T: Hash + Clone + Debug> { /* fields omitted */ }
A minimal perfect hash function over a set of objects of type T
.
Methods
impl<T: Hash + Clone + Debug> Mphf<T>
[src]
fn new(gamma: f64, objects: &Vec<T>, max_iters: Option<u64>) -> Mphf<T>
[src]
Generate a minimal perfect hash function for the set of objects
.
objects
must not contain any duplicate items.
gamma
controls the tradeoff between the construction-time and run-time speed,
and the size of the datastructure representing the hash function. See the paper for details.
max_iters
- None to never stop trying to find a perfect hash (safe if no duplicates).
fn hash(&self, item: &T) -> u64
[src]
Compute the hash value of item
. This method should only be used
with items known to be in construction set. Use try_hash
if you cannot
guarantee that item
was in the construction set. If item
was not present
in the construction set this function may panic.
fn try_hash(&self, item: &T) -> Option<u64>
[src]
Compute the hash value of item
. If item
was not present
in the set of objects used to construct the hash function, the return
value will an arbitrary value Some(x), or None.
Trait Implementations
impl<T: Hash + Clone + Debug> HeapSizeOf for Mphf<T>
[src]
fn heap_size_of_children(&self) -> usize
[src]
Measure the size of any heap-allocated structures that hang off this value, but not the space taken up by the value itself (i.e. what size_of:: measures, more or less); that space is handled by the implementation of HeapSizeOf for Box below. Read more