Struct boomphf_patched::Mphf

source ·
pub struct Mphf<T> { /* private fields */ }
Expand description

A minimal perfect hash function over a set of objects of type T.

Implementations§

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.

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).

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.

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.

Same as new, but parallelizes work on the rayon default Rayon threadpool. Configure the number of threads on that threadpool to control CPU usage.

Same as to from_chunked_iterator but parallelizes work over num_threads threads.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns approximate number of bytes occupied by dynamic (heap) part of self. Same as self.size_bytes() - std::mem::size_of_val(self). Read more
true if and only if the variables of this type can use dynamic (heap) memory.
Returns approximate number of bytes occupied by dynamic (heap) part of self content. It usually equals to size_bytes_dyn(). However, sometimes it is smaller by the amount of memory reserved but not yet used (e.g., size_bytes_content_dyn() only takes into account the length of the vector and not its capacity). Read more
Returns approximate, total (including heap memory) number of bytes occupied by self.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.