[][src]Struct boomphf::Mphf

pub struct Mphf<T> { /* fields omitted */ }

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]

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 IntoIterators 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]

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]

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]

Same as to from_chunked_iterator but parallelizes work over num_threads threads.

Trait Implementations

impl<T: Clone> Clone for Mphf<T>[src]

impl<T: Debug> Debug for Mphf<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for Mphf<T> where
    T: RefUnwindSafe
[src]

impl<T> Send for Mphf<T> where
    T: Send
[src]

impl<T> Sync for Mphf<T> where
    T: Sync
[src]

impl<T> Unpin for Mphf<T> where
    T: Unpin
[src]

impl<T> UnwindSafe for Mphf<T> where
    T: UnwindSafe
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.