pub trait BatchExt: Indicator {
// Provided methods
fn batch(&mut self, inputs: &[Self::Input]) -> Vec<Option<Self::Output>>
where Self::Input: Clone { ... }
fn batch_parallel<F>(
inputs_per_asset: &[Vec<Self::Input>],
make: F,
) -> Vec<Vec<Option<Self::Output>>>
where Self: Sized + Send,
Self::Input: Sync + Clone,
Self::Output: Send,
F: Fn() -> Self + Sync + Send { ... }
}Expand description
Blanket extension that adds batch evaluation to every Indicator.
The naive batch simply replays update over a slice, which is always correct
because update is the only state transition. Concrete indicators may override
batch if they have a faster vectorized path; the default keeps the contract
batch == repeated update.
Provided Methods§
Sourcefn batch(&mut self, inputs: &[Self::Input]) -> Vec<Option<Self::Output>>
fn batch(&mut self, inputs: &[Self::Input]) -> Vec<Option<Self::Output>>
Run the indicator over a slice of inputs in order, returning one output (or
None during warmup) per input.
Sourcefn batch_parallel<F>(
inputs_per_asset: &[Vec<Self::Input>],
make: F,
) -> Vec<Vec<Option<Self::Output>>>
Available on crate feature parallel only.
fn batch_parallel<F>( inputs_per_asset: &[Vec<Self::Input>], make: F, ) -> Vec<Vec<Option<Self::Output>>>
parallel only.Run an independent copy of the indicator over each input series in parallel.
Each asset is processed by its own fresh instance built via make, so state
never leaks across assets. Requires the parallel feature (enabled by
default), which pulls in rayon.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".