Trait EstimatorArray

Source
pub trait EstimatorArray<L: EstimationLogic + ?Sized> {
    type Estimator<'a>: Estimator<L>
       where Self: 'a;

    // Required methods
    fn logic(&self) -> &L;
    fn get_estimator(&self, index: usize) -> Self::Estimator<'_>;
    fn get_backend(&self, index: usize) -> &L::Backend;
    fn len(&self) -> usize;

    // Provided method
    fn is_empty(&self) -> bool { ... }
}
Expand description

An array of immutable estimators sharing a EstimationLogic.

Arrays of estimators are useful because they share the same logic, saving space with respect to a estimators. Moreover, by hiding the implementation, it is possible to create estimator arrays for estimators whose backends are slices.

Required Associated Types§

Source

type Estimator<'a>: Estimator<L> where Self: 'a

The type of immutable estimator returned by get_estimator.

Required Methods§

Source

fn logic(&self) -> &L

Returns the logic used by the estimators in the array.

Source

fn get_estimator(&self, index: usize) -> Self::Estimator<'_>

Returns the estimator at the specified index as an immutable estimator.

Note that this method will usually require some allocation, as it needs to create a new instance of EstimatorArray::Estimator.

Source

fn get_backend(&self, index: usize) -> &L::Backend

Returns an immutable reference to the backend of the estimator at the specified index.

This method will usually require no allocation.

Source

fn len(&self) -> usize

Returns the number of estimators in the array.

Provided Methods§

Source

fn is_empty(&self) -> bool

Returns true if the array contains no estimators.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<L: SliceEstimationLogic<W> + Clone, W: Word, S: AsRef<[W]>> EstimatorArray<L> for SliceEstimatorArray<L, W, S>

Source§

type Estimator<'a> = DefaultEstimator<L, &'a L, &'a [W]> where Self: 'a