Struct streaming_algorithms::HyperLogLog [−][src]
pub struct HyperLogLog<V: ?Sized> { /* fields omitted */ }
An implementation of the HyperLogLog data structure with bias correction.
See HyperLogLog: the analysis of a near-optimal cardinality estimation algorithm and HyperLogLog in Practice: Algorithmic Engineering of a State of The Art Cardinality Estimation Algorithm for background on HyperLogLog with bias correction.
Methods
impl<V: ?Sized> HyperLogLog<V> where
V: Hash,
[src]
impl<V: ?Sized> HyperLogLog<V> where
V: Hash,
pub fn new(error_rate: f64) -> Self
[src]
pub fn new(error_rate: f64) -> Self
Create an empty HyperLogLog
data structure with the specified error tolerance.
pub fn new_from(hll: &Self) -> Self
[src]
pub fn new_from(hll: &Self) -> Self
Create an empty HyperLogLog
data structure, copying the error tolerance from hll
.
pub fn push(&mut self, value: &V)
[src]
pub fn push(&mut self, value: &V)
"Visit" an element.
pub fn len(&self) -> f64
[src]
pub fn len(&self) -> f64
Retrieve an estimate of the carginality of the stream.
pub fn is_empty(&self) -> bool
[src]
pub fn is_empty(&self) -> bool
Returns true if the cardinality estimate is 0
pub fn union(&mut self, src: &Self)
[src]
pub fn union(&mut self, src: &Self)
Merge another HyperLogLog data structure into self
.
This is the same as an HLL approximating cardinality of the union of two multisets.
pub fn intersect(&mut self, src: &Self)
[src]
pub fn intersect(&mut self, src: &Self)
Intersect another HyperLogLog data structure into self
.
Note: This is different to an HLL approximating cardinality of the intersection of two multisets.
pub fn clear(&mut self)
[src]
pub fn clear(&mut self)
Clears the HyperLogLog
data structure, as if it was new.
Trait Implementations
impl<V: ?Sized> Clone for HyperLogLog<V>
[src]
impl<V: ?Sized> Clone for HyperLogLog<V>
fn clone(&self) -> Self
[src]
fn clone(&self) -> Self
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl<V: ?Sized> Debug for HyperLogLog<V> where
V: Hash,
[src]
impl<V: ?Sized> Debug for HyperLogLog<V> where
V: Hash,
fn fmt(&self, fmt: &mut Formatter) -> Result
[src]
fn fmt(&self, fmt: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<V: ?Sized> New for HyperLogLog<V> where
V: Hash,
[src]
impl<V: ?Sized> New for HyperLogLog<V> where
V: Hash,
type Config = f64
The type of data required to instantiate a new Self
.
fn new(config: &Self::Config) -> Self
[src]
fn new(config: &Self::Config) -> Self
Instantiate a new Self
with the given <Self as New>::Config
.
impl<V: ?Sized> Intersect for HyperLogLog<V> where
V: Hash,
[src]
impl<V: ?Sized> Intersect for HyperLogLog<V> where
V: Hash,
fn intersect<'a>(
iter: impl Iterator<Item = &'a Self>
) -> Option<Self> where
Self: Sized + 'a,
[src]
fn intersect<'a>(
iter: impl Iterator<Item = &'a Self>
) -> Option<Self> where
Self: Sized + 'a,
Intersect.
impl<'a, V: ?Sized> UnionAssign<&'a HyperLogLog<V>> for HyperLogLog<V> where
V: Hash,
[src]
impl<'a, V: ?Sized> UnionAssign<&'a HyperLogLog<V>> for HyperLogLog<V> where
V: Hash,
fn union_assign(&mut self, rhs: &'a Self)
[src]
fn union_assign(&mut self, rhs: &'a Self)
Union.
impl<'a, V: ?Sized> AddAssign<&'a V> for HyperLogLog<V> where
V: Hash,
[src]
impl<'a, V: ?Sized> AddAssign<&'a V> for HyperLogLog<V> where
V: Hash,
fn add_assign(&mut self, rhs: &'a V)
[src]
fn add_assign(&mut self, rhs: &'a V)
Performs the +=
operation.
Auto Trait Implementations
impl<V: ?Sized> Send for HyperLogLog<V>
impl<V: ?Sized> Send for HyperLogLog<V>
impl<V: ?Sized> Sync for HyperLogLog<V>
impl<V: ?Sized> Sync for HyperLogLog<V>