Skip to main content

HyperLogLogBuilder

Struct HyperLogLogBuilder 

Source
pub struct HyperLogLogBuilder<H, W = usize> { /* private fields */ }
Expand description

Builds a HyperLogLog cardinality-estimator logic.

Implementations§

Source§

impl HyperLogLogBuilder<BuildHasherDefault<DefaultHasher>>

Source

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>

Source

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).

Source

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.

Source

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.

Source

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.

Source

pub const fn num_elements(self, num_elements: usize) -> Self

Sets the upper bound on the number of elements.

§Panics

If n is zero.

Source

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.

Source

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>

Source§

fn clone(&self) -> HyperLogLogBuilder<H, W>

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<H: Debug, W: Debug> Debug for HyperLogLogBuilder<H, W>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<H, W> Freeze for HyperLogLogBuilder<H, W>
where H: Freeze,

§

impl<H, W> RefUnwindSafe for HyperLogLogBuilder<H, W>

§

impl<H, W> Send for HyperLogLogBuilder<H, W>
where H: Send, W: Send,

§

impl<H, W> Sync for HyperLogLogBuilder<H, W>
where H: Sync, W: Sync,

§

impl<H, W> Unpin for HyperLogLogBuilder<H, W>
where H: Unpin, W: Unpin,

§

impl<H, W> UnsafeUnpin for HyperLogLogBuilder<H, W>
where H: UnsafeUnpin,

§

impl<H, W> UnwindSafe for HyperLogLogBuilder<H, W>
where H: UnwindSafe, W: UnwindSafe,

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.