pub trait Estimator<L: EstimationLogic + ?Sized>: AsRef<L::Backend> {
type OwnedEstimator: EstimatorMut<L>;
// Required methods
fn logic(&self) -> &L;
fn estimate(&self) -> f64;
fn into_owned(self) -> Self::OwnedEstimator;
}
Expand description
An immutable estimator.
Immutable estimators are usually immutable views over some larger structure, or they contain some useful immutable state that can be reused.
An estimator must implement AsRef
so to return a reference to its backend.
Required Associated Types§
Sourcetype OwnedEstimator: EstimatorMut<L>
type OwnedEstimator: EstimatorMut<L>
The type returned by Estimator::into_owned
.
Required Methods§
Sourcefn estimate(&self) -> f64
fn estimate(&self) -> f64
Returns an estimation of the number of distinct elements that have been added to the estimator so far.
Sourcefn into_owned(self) -> Self::OwnedEstimator
fn into_owned(self) -> Self::OwnedEstimator
Converts this estimator into an owned version capable of mutation.