[−][src]Struct boomphf::Mphf
A minimal perfect hash function over a set of objects of type T
.
Implementations
impl<'a, T: 'a + Hash + Debug> Mphf<T>
[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,
[src]
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 + Debug> Mphf<T>
[src]
pub fn new(gamma: f64, objects: &[T]) -> 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).
pub 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.
pub fn try_hash<Q: ?Sized>(&self, item: &Q) -> Option<u64> where
T: Borrow<Q>,
Q: Hash,
[src]
T: Borrow<Q>,
Q: Hash,
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 + Debug + Sync + Send> Mphf<T>
[src]
pub fn new_parallel(
gamma: f64,
objects: &[T],
starting_seed: Option<u64>
) -> Mphf<T>
[src]
gamma: f64,
objects: &[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 + Debug + Send + Sync> Mphf<T>
[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,
[src]
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
impl<T> RefUnwindSafe for Mphf<T> where
T: RefUnwindSafe,
[src]
T: RefUnwindSafe,
impl<T> Send for Mphf<T> where
T: Send,
[src]
T: Send,
impl<T> Sync for Mphf<T> where
T: Sync,
[src]
T: Sync,
impl<T> Unpin for Mphf<T> where
T: Unpin,
[src]
T: Unpin,
impl<T> UnwindSafe for Mphf<T> where
T: UnwindSafe,
[src]
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,