use super::estimator::{EstimationLogic, Estimator, EstimatorMut};
pub trait EstimatorArray<L: EstimationLogic + ?Sized> {
type Estimator<'a>: Estimator<L>
where
Self: 'a;
fn logic(&self) -> &L;
fn get_estimator(&self, index: usize) -> Self::Estimator<'_>;
fn get_backend(&self, index: usize) -> &L::Backend;
fn len(&self) -> usize;
#[inline(always)]
fn is_empty(&self) -> bool {
self.len() == 0
}
}
pub trait EstimatorArrayMut<L: EstimationLogic + ?Sized>: EstimatorArray<L> {
type EstimatorMut<'a>: EstimatorMut<L>
where
Self: 'a;
fn get_estimator_mut(&mut self, index: usize) -> Self::EstimatorMut<'_>;
fn get_backend_mut(&mut self, index: usize) -> &mut L::Backend;
fn clear(&mut self);
}
pub trait AsSyncArray<L: EstimationLogic + ?Sized> {
type SyncEstimatorArray<'a>: SyncEstimatorArray<L>
where
Self: 'a;
fn as_sync_array(&mut self) -> Self::SyncEstimatorArray<'_>;
}
pub trait SyncEstimatorArray<L: EstimationLogic + ?Sized>: Sync {
fn logic(&self) -> &L;
unsafe fn set(&self, index: usize, content: &L::Backend);
unsafe fn get(&self, index: usize, content: &mut L::Backend);
unsafe fn clear(&self);
fn len(&self) -> usize;
#[inline(always)]
fn is_empty(&self) -> bool {
self.len() == 0
}
}