pub struct FPHash2<GS: GroupSize = TwoToPowerBits, SS: SeedSize = TwoToPowerBitsStatic<2>, S = BuildDefaultSeededHasher> { /* private fields */ }Expand description
Fingerprinting-based minimal perfect hash function with group optimization (FMPHGO).
See:
- P. Beling, Fingerprinting-based minimal perfect hashing revisited
Implementations§
source§impl<GS: GroupSize + Sync, SS: SeedSize, S: BuildSeededHasher + Sync> FPHash2<GS, SS, S>
impl<GS: GroupSize + Sync, SS: SeedSize, S: BuildSeededHasher + Sync> FPHash2<GS, SS, S>
sourcepub fn get_stats<K: Hash, A: AccessStatsCollector>(
&self,
key: &K,
access_stats: &mut A
) -> Option<u64>
pub fn get_stats<K: Hash, A: AccessStatsCollector>(
&self,
key: &K,
access_stats: &mut A
) -> Option<u64>
Gets the value associated with the given key and reports statistics to access_stats.
sourcepub fn get<K: Hash>(&self, key: &K) -> Option<u64>
pub fn get<K: Hash>(&self, key: &K) -> Option<u64>
Gets the value associated with the given key.
sourcepub fn with_builder_stats<K, KS, BS>(
keys: KS,
levels: FPHash2Builder<GS, SS, S>,
stats: &mut BS
) -> Selfwhere
K: Hash + Sync,
KS: KeySet<K> + Sync,
BS: BuildStatsCollector,
pub fn with_builder_stats<K, KS, BS>(
keys: KS,
levels: FPHash2Builder<GS, SS, S>,
stats: &mut BS
) -> Selfwhere
K: Hash + Sync,
KS: KeySet<K> + Sync,
BS: BuildStatsCollector,
Builds FPHash2 for given keys, using the configuration conf and reporting statistics to stats.
pub fn with_builder<K, KS>(keys: KS, levels: FPHash2Builder<GS, SS, S>) -> Selfwhere
K: Hash + Sync,
KS: KeySet<K> + Sync,
pub fn with_conf_stats<K, KS, BS>(
keys: KS,
conf: FPHash2Conf<GS, SS, S>,
stats: &mut BS
) -> Selfwhere
K: Hash + Sync,
KS: KeySet<K> + Sync,
BS: BuildStatsCollector,
pub fn with_conf_mt_stats<K, KS, BS>(
keys: KS,
conf: FPHash2Conf<GS, SS, S>,
use_multiple_threads: bool,
stats: &mut BS
) -> Selfwhere
K: Hash + Sync,
KS: KeySet<K> + Sync,
BS: BuildStatsCollector,
pub fn with_conf<K, KS>(keys: KS, conf: FPHash2Conf<GS, SS, S>) -> Selfwhere
K: Hash + Sync,
KS: KeySet<K> + Sync,
pub fn with_conf_mt<K, KS>(
keys: KS,
conf: FPHash2Conf<GS, SS, S>,
use_multiple_threads: bool
) -> Selfwhere
K: Hash + Sync,
KS: KeySet<K> + Sync,
sourcepub fn from_slice_with_conf_stats<K, BS>(
keys: &[K],
conf: FPHash2Conf<GS, SS, S>,
stats: &mut BS
) -> Selfwhere
K: Hash + Sync,
BS: BuildStatsCollector,
pub fn from_slice_with_conf_stats<K, BS>(
keys: &[K],
conf: FPHash2Conf<GS, SS, S>,
stats: &mut BS
) -> Selfwhere
K: Hash + Sync,
BS: BuildStatsCollector,
Builds FPHash2 for given keys, using the configuration conf.
pub fn from_slice_with_conf_mt_stats<K, BS>(
keys: &[K],
conf: FPHash2Conf<GS, SS, S>,
use_multiple_threads: bool,
stats: &mut BS
) -> Selfwhere
K: Hash + Sync,
BS: BuildStatsCollector,
sourcepub fn from_slice_with_conf<K>(keys: &[K], conf: FPHash2Conf<GS, SS, S>) -> Selfwhere
K: Hash + Sync,
pub fn from_slice_with_conf<K>(keys: &[K], conf: FPHash2Conf<GS, SS, S>) -> Selfwhere
K: Hash + Sync,
Builds FPHash2 for given keys, using the configuration conf.
pub fn from_slice_with_conf_mt<K>(
keys: &[K],
conf: FPHash2Conf<GS, SS, S>,
use_multiple_threads: bool
) -> Selfwhere
K: Hash + Sync,
sourcepub fn from_slice_mut_with_conf_stats<K, BS>(
keys: &mut [K],
conf: FPHash2Conf<GS, SS, S>,
stats: &mut BS
) -> Selfwhere
K: Hash + Sync,
BS: BuildStatsCollector,
pub fn from_slice_mut_with_conf_stats<K, BS>(
keys: &mut [K],
conf: FPHash2Conf<GS, SS, S>,
stats: &mut BS
) -> Selfwhere
K: Hash + Sync,
BS: BuildStatsCollector,
Builds FPHash2 for given keys, using the configuration conf.
sourcepub fn from_slice_mut_with_conf<K>(
keys: &mut [K],
conf: FPHash2Conf<GS, SS, S>
) -> Selfwhere
K: Hash + Sync,
pub fn from_slice_mut_with_conf<K>(
keys: &mut [K],
conf: FPHash2Conf<GS, SS, S>
) -> Selfwhere
K: Hash + Sync,
Builds FPHash2 for given keys, using the configuration conf.
sourcepub fn write_bytes(&self) -> usize
pub fn write_bytes(&self) -> usize
Returns number of bytes which write will write.
sourcepub fn read_with_hasher(input: &mut dyn Read, hasher: S) -> Result<Self>
pub fn read_with_hasher(input: &mut dyn Read, hasher: S) -> Result<Self>
Reads Self from the input. Hasher must be the same as the one used to write.
pub fn level_sizes(&self) -> &[u64]
source§impl FPHash2
impl FPHash2
sourcepub fn from_slice_with_stats<K, BS>(keys: &[K], stats: &mut BS) -> Selfwhere
K: Hash + Sync,
BS: BuildStatsCollector,
pub fn from_slice_with_stats<K, BS>(keys: &[K], stats: &mut BS) -> Selfwhere
K: Hash + Sync,
BS: BuildStatsCollector,
Builds FPHash2 for given keys, reporting statistics to stats.
sourcepub fn from_slice<K: Hash + Sync>(keys: &[K]) -> Self
pub fn from_slice<K: Hash + Sync>(keys: &[K]) -> Self
Builds FPHash2 for given keys.
Trait Implementations§
source§impl<GS: GroupSize, SS: SeedSize, S: BuildSeededHasher> GetSize for FPHash2<GS, SS, S>
impl<GS: GroupSize, SS: SeedSize, S: BuildSeededHasher> GetSize for FPHash2<GS, SS, S>
source§fn size_bytes_dyn(&self) -> usize
fn size_bytes_dyn(&self) -> usize
self.
Same as self.size_bytes() - std::mem::size_of_val(self). Read moresource§const USES_DYN_MEM: bool = true
const USES_DYN_MEM: bool = true
true if and only if the variables of this type can use dynamic (heap) memory.source§fn size_bytes_content_dyn(&self) -> usize
fn size_bytes_content_dyn(&self) -> usize
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 moresource§fn size_bytes(&self) -> usize
fn size_bytes(&self) -> usize
self.