Skip to main content

BloomFilterPropertiesBuilder

Struct BloomFilterPropertiesBuilder 

Source
pub struct BloomFilterPropertiesBuilder {
    fpp: Option<f64>,
    ndv: Option<u64>,
}
Expand description

Fields§

§fpp: Option<f64>§ndv: Option<u64>

Implementations§

Source§

impl BloomFilterPropertiesBuilder

Source

pub fn new() -> Self

Returns a new builder with no fields set.

Equivalent to BloomFilterProperties::builder.

Source

pub fn with_fpp(self, fpp: f64) -> Self

Sets the target false positive probability.

The value must be in (0.0, 1.0) exclusively; this is validated at build time by Self::build / Self::try_build. When unset, the default is 0.05 (5%, see DEFAULT_BLOOM_FILTER_FPP).

Source

pub fn with_max_ndv(self, ndv: u64) -> Self

Sets the maximum expected number of distinct values used to size the bloom filter before folding.

When unset, the default is 1_048_576 (see DEFAULT_BLOOM_FILTER_NDV), which at the default fpp of 5% reserves roughly 1 MiB per column for the filter bitset, derived as follows:

ndv = 1,048,576, fpp = 0.05
  0.05^(1/8)                         ≈ 0.6877
  1 - 0.6877                         ≈ 0.3123
  ln(0.3123)                         ≈ -1.164
  num_bits = -8 * 1,048,576 / -1.164 ≈ 7,206,000 bits
                                     ≈   900,750 bytes (~900 KB)
  next_power_of_two(900 KB)          = 1 MiB (= 1,048,576 bytes)
Source

pub fn build(self) -> BloomFilterProperties

Builds BloomFilterProperties.

Panics if the configured fpp is not in (0.0, 1.0) exclusive. Use Self::try_build for a non-panicking alternative.

Source

pub fn try_build(self) -> Result<BloomFilterProperties>

Builds BloomFilterProperties, returning an error instead of panicking when the configured fpp is not in (0.0, 1.0) exclusive.

Trait Implementations§

Source§

impl Clone for BloomFilterPropertiesBuilder

Source§

fn clone(&self) -> BloomFilterPropertiesBuilder

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for BloomFilterPropertiesBuilder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for BloomFilterPropertiesBuilder

Source§

fn default() -> BloomFilterPropertiesBuilder

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

§

impl<T> Ungil for T
where T: Send,