pub struct HyperLogLogBuilder<H, W = usize> { /* private fields */ }Expand description
Builds a HyperLogLog cardinality-estimator logic.
Implementations§
Source§impl HyperLogLogBuilder<BuildHasherDefault<DefaultHasher>>
impl HyperLogLogBuilder<BuildHasherDefault<DefaultHasher>>
Sourcepub const fn new(num_elements: usize) -> Self
pub const fn new(num_elements: usize) -> Self
Creates a new builder for a HyperLogLog logic with the default word
type (the fixed-size equivalent of usize).
§Panics
If n is zero.
Source§impl<H, W: Word> HyperLogLogBuilder<H, W>
impl<H, W: Word> HyperLogLogBuilder<H, W>
Sourcepub fn rsd(self, rsd: f64) -> Self
pub fn rsd(self, rsd: f64) -> Self
Sets the desired relative standard deviation.
§Note
This is a high-level alternative to Self::log_2_num_reg. Calling one
after the other invalidates the work done by the first one.
§Arguments
rsd: the relative standard deviation to be attained.
§Panics
If the resulting number of registers is less than 16 (i.e., rsd is
too large).
Sourcepub const fn log_2_num_reg(self, log_2_num_registers: usize) -> Self
pub const fn log_2_num_reg(self, log_2_num_registers: usize) -> Self
Sets the base-2 logarithm of the number of registers.
§Note
This is a low-level alternative to Self::rsd. Calling one after the
other invalidates the work done by the first one.
§Arguments
log_2_num_registers: the logarithm of the number of registers per estimator.
§Panics
If log_2_num_registers is less than 4.
Sourcepub fn min_log_2_num_reg(&self) -> usize
pub fn min_log_2_num_reg(&self) -> usize
Returns the minimum value allowed for Self::log_2_num_reg given the current value of
Self::num_elements.
Sourcepub fn word_type<W2>(self) -> HyperLogLogBuilder<H, W2>
pub fn word_type<W2>(self) -> HyperLogLogBuilder<H, W2>
Sets the type W to use to represent backends.
Note that the returned builder will have a different type if W2 is
different from W.
See the logic documentation for the limitations on the
choice of W2.
Sourcepub const fn num_elements(self, num_elements: usize) -> Self
pub const fn num_elements(self, num_elements: usize) -> Self
Sourcepub fn build_hasher<H2>(self, build_hasher: H2) -> HyperLogLogBuilder<H2, W>
pub fn build_hasher<H2>(self, build_hasher: H2) -> HyperLogLogBuilder<H2, W>
Sets the BuildHasher to use.
Using this method you can select a specific hasher based on one or more seeds.
Sourcepub fn build<T>(self) -> HyperLogLog<T, H, W>
pub fn build<T>(self) -> HyperLogLog<T, H, W>
Builds the logic.
The type of objects the estimators keep track of is defined here by T,
but it is usually inferred by the compiler.
§Panics
If the estimator size in bits is not divisible by the bit width of W.
Trait Implementations§
Source§impl<H: Clone, W: Clone> Clone for HyperLogLogBuilder<H, W>
impl<H: Clone, W: Clone> Clone for HyperLogLogBuilder<H, W>
Source§fn clone(&self) -> HyperLogLogBuilder<H, W>
fn clone(&self) -> HyperLogLogBuilder<H, W>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more