pub trait Next<Input> {
type Output;
fn next(&mut self, input: Input) -> Self::Output;
fn next_batch(&mut self, inputs: &[Input]) -> Vec<Self::Output>
where
Input: Copy,
{
let mut outputs = Vec::with_capacity(inputs.len());
for &input in inputs {
outputs.push(self.next(input));
}
outputs
}
}
pub trait SmoothingAlgorithm: Next<f64, Output = f64> + Clone + Send + Sync {}
pub trait IndicatorConfig {
type Indicator: Next<f64>;
fn build(&self) -> Self::Indicator;
}
impl<T> SmoothingAlgorithm for T where T: Next<f64, Output = f64> + Clone + Send + Sync {}