Skip to main content

SeedSize

Trait SeedSize 

Source
pub trait SeedSize:
    Copy
    + Into<u8>
    + Sync
    + TryFrom<u8, Error = &'static str> {
    type VecElement: Copy + Send + Sync + Sized + GetSize;

    const VEC_ELEMENT_BIT_SIZE: usize = _;

    // Required methods
    fn new_seed_vec(
        &self,
        seed: u16,
        number_of_seeds: usize,
    ) -> Box<[Self::VecElement]>;
    unsafe fn get_seed(&self, vec: &[Self::VecElement], index: usize) -> u16;
    unsafe fn set_seed(
        &self,
        vec: &mut [Self::VecElement],
        index: usize,
        seed: u16,
    );
    fn write_seed_vec(
        &self,
        output: &mut dyn Write,
        seeds: &[Self::VecElement],
    ) -> Result<()>;
    fn read_seed_vec(
        input: &mut dyn Read,
        number_of_seeds: usize,
    ) -> Result<(Self, Box<[Self::VecElement]>)>;

    // Provided methods
    fn validate(&self) -> Result<Self, &'static str> { ... }
    fn new_zeroed_seed_vec(
        &self,
        number_of_seeds: usize,
    ) -> Box<[Self::VecElement]> { ... }
    unsafe fn init_seed(
        &self,
        vec: &mut [Self::VecElement],
        index: usize,
        seed: u16,
    ) { ... }
    fn concatenate_seed_vecs<LSI, LS>(
        &self,
        level_sizes: LS,
        seeds: Vec<Box<[Self::VecElement]>>,
    ) -> Box<[Self::VecElement]>
       where LSI: IntoIterator<Item = usize>,
             LS: Fn() -> LSI { ... }
    fn write(&self, output: &mut dyn Write) -> Result<()> { ... }
    fn read(input: &mut dyn Read) -> Result<Self> { ... }
}
Expand description

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

Provided Associated Constants§

Required Associated Types§

Required Methods§

Source

fn new_seed_vec( &self, seed: u16, number_of_seeds: usize, ) -> Box<[Self::VecElement]>

Source

unsafe fn get_seed(&self, vec: &[Self::VecElement], index: usize) -> u16

Gets seed with given index from vec. Does not check whether the index is within bounds.

Source

unsafe fn set_seed(&self, vec: &mut [Self::VecElement], index: usize, seed: u16)

Sets seed with given index in vec to seed. Does not check whether the index is within bounds.

Source

fn write_seed_vec( &self, output: &mut dyn Write, seeds: &[Self::VecElement], ) -> Result<()>

Source

fn read_seed_vec( input: &mut dyn Read, number_of_seeds: usize, ) -> Result<(Self, Box<[Self::VecElement]>)>

Provided Methods§

Source

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

Source

fn new_zeroed_seed_vec(&self, number_of_seeds: usize) -> Box<[Self::VecElement]>

Source

unsafe fn init_seed( &self, vec: &mut [Self::VecElement], index: usize, seed: u16, )

Sets seed with given index in zeroed vec to seed. Does not check whether the index is within bounds and vec is zeroed.

Source

fn concatenate_seed_vecs<LSI, LS>( &self, level_sizes: LS, seeds: Vec<Box<[Self::VecElement]>>, ) -> Box<[Self::VecElement]>
where LSI: IntoIterator<Item = usize>, LS: Fn() -> LSI,

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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§