Trait Metric
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 Constants§
Required Associated Types§
type Input
type Input
The input type of the metric.
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.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.