[−][src]Struct boomphf::Mphf
A minimal perfect hash function over a set of objects of type T
.
Methods
impl<'a, T: 'a + Hash + Clone + Debug> Mphf<T>
[src]
impl<'a, T: 'a + Hash + Clone + Debug> Mphf<T>
pub fn from_chunked_iterator<I, N>(
gamma: f64,
objects: &'a I,
n: usize
) -> Mphf<T> where
&'a I: IntoIterator<Item = N>,
N: IntoIterator<Item = T> + Send,
<N as IntoIterator>::IntoIter: ExactSizeIterator,
<&'a I as IntoIterator>::IntoIter: Send,
I: Sync,
[src]
pub fn from_chunked_iterator<I, N>(
gamma: f64,
objects: &'a I,
n: usize
) -> Mphf<T> where
&'a I: IntoIterator<Item = N>,
N: IntoIterator<Item = T> + Send,
<N as IntoIterator>::IntoIter: ExactSizeIterator,
<&'a I as IntoIterator>::IntoIter: Send,
I: Sync,
Constructs an MPHF from a (possibly lazy) iterator over iterators.
This allows construction of very large MPHFs without holding all the keys
in memory simultaneously.
objects
is an IntoInterator
yielding a stream of IntoIterator
s that must not contain any duplicate items.
objects
must be able to be iterated over multiple times and yield the same stream of items each time.
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).
NOTE: the inner iterator N::IntoIter
should override nth
if there's an efficient way to skip
over items when iterating. This is important because later iterations of the MPHF construction algorithm
skip most of the items.
impl<T: Hash + Clone + Debug> Mphf<T>
[src]
impl<T: Hash + Clone + Debug> Mphf<T>
pub fn new(gamma: f64, objects: &Vec<T>) -> Mphf<T>
[src]
pub fn new(gamma: f64, objects: &Vec<T>) -> Mphf<T>
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).
pub fn hash(&self, item: &T) -> u64
[src]
pub fn hash(&self, item: &T) -> u64
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.
pub fn try_hash(&self, item: &T) -> Option<u64>
[src]
pub fn try_hash(&self, item: &T) -> Option<u64>
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.
impl<T: Hash + Clone + Debug + Sync + Send> Mphf<T>
[src]
impl<T: Hash + Clone + Debug + Sync + Send> Mphf<T>
pub fn new_parallel(
gamma: f64,
objects: &Vec<T>,
starting_seed: Option<u64>
) -> Mphf<T>
[src]
pub fn new_parallel(
gamma: f64,
objects: &Vec<T>,
starting_seed: Option<u64>
) -> Mphf<T>
Same as new
, but parallelizes work on the rayon default Rayon threadpool.
Configure the number of threads on that threadpool to control CPU usage.
impl<'a, T: 'a + Hash + Clone + Debug + Send + Sync> Mphf<T>
[src]
impl<'a, T: 'a + Hash + Clone + Debug + Send + Sync> Mphf<T>
pub fn from_chunked_iterator_parallel<I, N>(
gamma: f64,
objects: &'a I,
max_iters: Option<u64>,
n: usize,
num_threads: usize
) -> Mphf<T> where
&'a I: IntoIterator<Item = N>,
N: IntoIterator<Item = T> + Send + Clone,
<N as IntoIterator>::IntoIter: ExactSizeIterator,
<&'a I as IntoIterator>::IntoIter: Send,
I: Sync,
[src]
pub fn from_chunked_iterator_parallel<I, N>(
gamma: f64,
objects: &'a I,
max_iters: Option<u64>,
n: usize,
num_threads: usize
) -> Mphf<T> where
&'a I: IntoIterator<Item = N>,
N: IntoIterator<Item = T> + Send + Clone,
<N as IntoIterator>::IntoIter: ExactSizeIterator,
<&'a I as IntoIterator>::IntoIter: Send,
I: Sync,
Same as to from_chunked_iterator
but parallelizes work over num_threads
threads.
Trait Implementations
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T> From for T
[src]
impl<T> From for T
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId
[src]
fn get_type_id(&self) -> TypeId
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
fn borrow_mut(&mut self) -> &mut T