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