pub type DynMetric<'a> = dyn Metric<Output = ErasedEvaluation> + 'a;Expand description
A heterogeneous metric object with a common structured result. The lifetime
permits a scorer to borrow configuration; only its owned result must be
static for native downcasting. Use crate::score for checked evaluation.
use zenpsy_api::{DynMetric, ErasedEvaluation, EvalOpts, MetricResult, score};
use zenpsy_api::zenpixels::PixelView;
fn run_all(metrics: &mut [Box<DynMetric<'_>>], r: &PixelView<'_>, d: &PixelView<'_>)
-> MetricResult<Vec<ErasedEvaluation>>
{
metrics.iter_mut().map(|m| score(m, r, d, EvalOpts::new())).collect()
}