pub trait HyperLogLogIterator<const PRECISION: usize, const BITS: usize> {
    // Required method
    fn union(self) -> HyperLogLog<PRECISION, BITS>;
}

Required Methods§

source

fn union(self) -> HyperLogLog<PRECISION, BITS>

Returns a HyperLogLog that is the union of all HyperLogLogs in the iterator.

Example
use hyperloglog_rs::prelude::*;

let mut hll1 = HyperLogLog::<12, 6>::new();
hll1.insert(&1);
hll1.insert(&2);

let mut hll2 = HyperLogLog::<12, 6>::new();
hll2.insert(&3);
hll2.insert(&4);

let mut hll3 = HyperLogLog::<12, 6>::new();
hll3.insert(&5);
hll3.insert(&6);

let hll_union = vec![hll1, hll2, hll3].iter().union();

assert!(hll_union.estimate_cardinality() - 6.0 < 1.0, "Expected 6.0, got {}", hll_union.estimate_cardinality());

Implementors§

source§

impl<const PRECISION: usize, const BITS: usize, I, C> HyperLogLogIterator<PRECISION, BITS> for Iwhere I: Iterator<Item = C>, HyperLogLog<PRECISION, BITS>: BitOr<C, Output = HyperLogLog<PRECISION, BITS>>,