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§
Sourcetype Estimator<'a>: Estimator<L>
where
Self: 'a
type Estimator<'a>: Estimator<L> where Self: 'a
The type of immutable estimator returned by
get_estimator
.
Required Methods§
Sourcefn get_estimator(&self, index: usize) -> Self::Estimator<'_>
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
.
Sourcefn get_backend(&self, index: usize) -> &L::Backend
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.
Provided Methods§
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.