Trait ph::fmph::goindexing::GroupSize

source ·
pub trait GroupSize: Sized + Mul<usize, Output = usize> + Copy + Into<u8> + TryFrom<u8, Error = &'static str> {
    // Provided methods
    fn validate(&self) -> Result<Self, &'static str> { ... }
    fn hash_to_group(&self, hash: u32) -> u8 { ... }
    fn in_group_index(&self, hash: u64, group_seed: u16) -> u8 { ... }
    fn bit_index_for_seed(
        &self,
        hash: u64,
        group_seed: u16,
        group: u64
    ) -> usize { ... }
    fn level_size_groups_segments(
        &self,
        desired_total_size: usize
    ) -> (usize, usize) { ... }
    fn copy_group_if_better<CB>(
        &self,
        dst: &mut [u64],
        src: &[u64],
        group_index: usize,
        callback: CB
    )
       where CB: FnOnce() { ... }
    fn write_size_bytes(&self) -> usize { ... }
    fn write(&self, output: &mut dyn Write) -> Result<()> { ... }
    fn read(input: &mut dyn Read) -> Result<Self> { ... }
}
Expand description

Implementations of GroupSize represent group size in fingerprinting-based minimal perfect hashing with group optimization.

Provided Methods§

source

fn validate(&self) -> Result<Self, &'static str>

source

fn hash_to_group(&self, hash: u32) -> u8

Returns hash modulo self.

source

fn in_group_index(&self, hash: u64, group_seed: u16) -> u8

Returns index in the group with given seed group_seed using hasher which must be modified earlier by group_nr function.

source

fn bit_index_for_seed(&self, hash: u64, group_seed: u16, group: u64) -> usize

Returns bit index inside the group with number group and seed group_seed, assigned to the key hashed by the hasher.

source

fn level_size_groups_segments( &self, desired_total_size: usize ) -> (usize, usize)

Returns number of groups and 64-bit segments for given desired_total_size.

source

fn copy_group_if_better<CB>( &self, dst: &mut [u64], src: &[u64], group_index: usize, callback: CB )
where CB: FnOnce(),

Returns number of ones in the group. If group with given index has more ones in dst than in src, then copy it from src to dst and call callback.

source

fn write_size_bytes(&self) -> usize

Returns number of bytes that self.write writes to the output.

source

fn write(&self, output: &mut dyn Write) -> Result<()>

Writes self to output.

source

fn read(input: &mut dyn Read) -> Result<Self>

Reads Self from input.

Object Safety§

This trait is not object safe.

Implementors§