Crate ph

source ·
Expand description

ph is the Rust library (by Piotr Beling) of data structures based on perfect hashing.

Example

use ph::FPHash;

let keys = ['a', 'b', 'c', 'z'];
let f = FPHash::from(&keys[..]);
// f assigns each key a unique number from the set {0, 1, 2, 3}
let mut values: Vec<_> = keys.iter().map(|k| f.get(k).unwrap()).collect();
values.sort();
assert_eq!(values, [0, 1, 2, 3]);

Re-exports

pub use seedable_hash::BuildSeededHasher;
pub use seedable_hash::Seedable;
pub use seedable_hash::BuildDefaultSeededHasher;

Modules

Macros

Calculates the number of bits needed to store values from 0 up to given one (works only for non-negative integers).
Reads array of integers from given input.

Structs

Fingerprinting-based minimal perfect hash function (FMPH).
Fingerprinting-based minimal perfect hash function with group optimization (FMPHGO).
Configuration that is accepted by FPHash2 constructors.
Configuration that is accepted by FPHash constructors.

Traits

Provides methods to get dynamic and total size of the variable.