pub trait Metric: Send + Sync {
type Input;
const NAME: &'static str;
// Required methods
fn update(
&mut self,
item: &Self::Input,
metadata: &MetricMetadata,
) -> MetricEntry;
fn clear(&mut self);
}
Expand description
Metric trait.
§Notes
Implementations should define their own input type only used by the metric. This is important since some conflict may happen when the model output is adapted for each metric’s input type.
Required Associated Types§
type Input
type Input
The input type of the metric.
Required Associated Constants§
Required Methods§
fn update(
&mut self,
item: &Self::Input,
metadata: &MetricMetadata,
) -> MetricEntry
fn update( &mut self, item: &Self::Input, metadata: &MetricMetadata, ) -> MetricEntry
Update the metric state and returns the current metric entry.
fn clear(&mut self)
fn clear(&mut self)
Clear the metric state.
Object Safety§
This trait is not object safe.