prometheus_wire/parser/
comment.rs1#[derive(Debug, PartialEq)]
4pub enum CommentType {
5 TYPE,
6 HELP,
7 UNKNOWN,
8}
9
10#[derive(Debug, PartialEq)]
12pub struct Comment {
13 pub metric: String,
14 pub comment_type: CommentType,
15 pub description: String,
16}
17
18impl From<&str> for CommentType {
19 fn from(s: &str) -> Self {
20 match s {
21 "TYPE" => CommentType::TYPE,
22 "HELP" => CommentType::HELP,
23 _ => CommentType::UNKNOWN,
24 }
25 }
26}
27
28impl Comment {
29 pub fn new(metric: String, comment_type: CommentType, desc: String) -> Self {
30 Comment {
31 metric,
32 comment_type,
33 description: desc,
34 }
35 }
36}