1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
use strum::AsRefStr;
#[derive(Debug, Copy, Clone)]
/// Static File filters.
pub enum Filters {
/// Static File uses filters with [`InclusionFilter`] and [`PerfectHashingFunction`].
WithFilters(InclusionFilter, PerfectHashingFunction),
/// Static File doesn't use any filters.
WithoutFilters,
}
impl Filters {
/// Returns `true` if static file uses filters.
pub const fn has_filters(&self) -> bool {
matches!(self, Self::WithFilters(_, _))
}
}
#[derive(Debug, Copy, Clone, AsRefStr)]
#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
/// Static File inclusion filter. Also see [Filters].
pub enum InclusionFilter {
#[strum(serialize = "cuckoo")]
/// Cuckoo filter
Cuckoo,
}
#[derive(Debug, Copy, Clone, AsRefStr)]
#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
/// Static File perfect hashing function. Also see [Filters].
pub enum PerfectHashingFunction {
#[strum(serialize = "fmph")]
/// Fingerprint-Based Minimal Perfect Hash Function
Fmph,
#[strum(serialize = "gofmph")]
/// Fingerprint-Based Minimal Perfect Hash Function with Group Optimization
GoFmph,
}