pub trait EncodeMetric {
// Required methods
fn encode(&self, encoder: MetricEncoder<'_>) -> Result<(), Error>;
fn metric_type(&self) -> MetricType;
// Provided method
fn is_empty(&self) -> bool { ... }
}Expand description
Trait implemented by each metric type, e.g.
Counter, to implement its encoding in
the OpenMetric text format.
Required Methods§
Sourcefn encode(&self, encoder: MetricEncoder<'_>) -> Result<(), Error>
fn encode(&self, encoder: MetricEncoder<'_>) -> Result<(), Error>
Encode the given instance in the OpenMetrics text encoding.
Sourcefn metric_type(&self) -> MetricType
fn metric_type(&self) -> MetricType
The OpenMetrics metric type of the instance.