1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
use crate::{
encoding::{EncodeLabelSet, EncodeMetric, MetricEncoder},
metrics::{MetricType, TypedMetric},
};
#[derive(Debug)]
pub struct Info<S>(pub(crate) S);
impl<S> Info<S> {
pub fn new(label_set: S) -> Self {
Self(label_set)
}
}
impl<S> TypedMetric for Info<S> {
const TYPE: MetricType = MetricType::Info;
}
impl<S> EncodeMetric for Info<S>
where
S: Clone + std::hash::Hash + Eq + EncodeLabelSet,
{
fn encode(&self, mut encoder: MetricEncoder) -> Result<(), std::fmt::Error> {
encoder.encode_info(&self.0)
}
fn metric_type(&self) -> MetricType {
Self::TYPE
}
}