Skip to main content

DefaultEstimator

Struct DefaultEstimator 

Source
pub struct DefaultEstimator<L: EstimationLogic, BL: Borrow<L>, B> { /* private fields */ }
Expand description

A default estimator for generic EstimationLogic and backends.

Implementations§

Source§

impl<L: EstimationLogic, BL: Borrow<L>, B> DefaultEstimator<L, BL, B>

Source

pub const fn new(logic: BL, backend: B) -> Self

Creates a new default estimator for the specified logic and backend.

§Arguments
  • logic: the estimator logic.
  • backend: the estimator’s backend.

Trait Implementations§

Source§

impl<L: EstimationLogic + Clone, BL: Borrow<L>, B: AsMut<L::Backend>> AsMut<<L as EstimationLogic>::Backend> for DefaultEstimator<L, BL, B>

Source§

fn as_mut(&mut self) -> &mut L::Backend

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl<L: EstimationLogic + Clone, BL: Borrow<L>, B: AsRef<L::Backend>> AsRef<<L as EstimationLogic>::Backend> for DefaultEstimator<L, BL, B>

Source§

fn as_ref(&self) -> &L::Backend

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<L: EstimationLogic + Clone, BL: Borrow<L>, B: AsRef<L::Backend>> Estimator<L> for DefaultEstimator<L, BL, B>
where for<'a> Box<L::Backend>: From<&'a L::Backend>,

Source§

type OwnedEstimator = DefaultEstimator<L, L, Box<<L as EstimationLogic>::Backend>>

The type returned by Estimator::into_owned.
Source§

fn logic(&self) -> &L

Returns the logic of the estimator.
Source§

fn estimate(&self) -> f64

Returns an estimation of the number of distinct elements that have been added to the estimator so far.
Source§

fn into_owned(self) -> Self::OwnedEstimator

Converts this estimator into an owned version capable of mutation.
Source§

impl<L: EstimationLogic + Clone, BL: Borrow<L>, B: AsRef<L::Backend> + AsMut<L::Backend>> EstimatorMut<L> for DefaultEstimator<L, BL, B>
where for<'a> Box<L::Backend>: From<&'a L::Backend>,

Source§

fn add(&mut self, element: impl Borrow<L::Item>)

Adds an element to the estimator.
Source§

fn clear(&mut self)

Clears the estimator, making it empty.
Source§

fn set(&mut self, backend: &L::Backend)

Sets the contents of self to the given backend. Read more
Source§

impl<L: EstimationLogic + MergeEstimationLogic + Clone, BL: Borrow<L>, B: AsRef<L::Backend> + AsMut<L::Backend>> MergeEstimator<L> for DefaultEstimator<L, BL, B>
where for<'a> Box<L::Backend>: From<&'a L::Backend>,

Source§

fn merge(&mut self, other: &L::Backend)

Merges a backend into self. Read more
Source§

fn merge_with_helper( &mut self, other: &L::Backend, helper: &mut <L as MergeEstimationLogic>::Helper, )

Merges a backend into self using the provided helper to avoid excessive allocations. Read more

Auto Trait Implementations§

§

impl<L, BL, B> Freeze for DefaultEstimator<L, BL, B>
where BL: Freeze, B: Freeze,

§

impl<L, BL, B> RefUnwindSafe for DefaultEstimator<L, BL, B>

§

impl<L, BL, B> Send for DefaultEstimator<L, BL, B>
where BL: Send, B: Send, L: Send,

§

impl<L, BL, B> Sync for DefaultEstimator<L, BL, B>
where BL: Sync, B: Sync, L: Sync,

§

impl<L, BL, B> Unpin for DefaultEstimator<L, BL, B>
where BL: Unpin, B: Unpin, L: Unpin,

§

impl<L, BL, B> UnsafeUnpin for DefaultEstimator<L, BL, B>
where BL: UnsafeUnpin, B: UnsafeUnpin,

§

impl<L, BL, B> UnwindSafe for DefaultEstimator<L, BL, B>
where BL: UnwindSafe, B: UnwindSafe, L: 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> 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, 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.