#[derive(Debug, PartialEq)]
pub enum CommentType {
TYPE,
HELP,
UNKNOWN,
}
#[derive(Debug, PartialEq)]
pub struct Comment {
pub metric: String,
pub comment_type: CommentType,
pub description: String,
}
impl From<&str> for CommentType {
fn from(s: &str) -> Self {
match s {
"TYPE" => CommentType::TYPE,
"HELP" => CommentType::HELP,
_ => CommentType::UNKNOWN,
}
}
}
impl Comment {
pub fn new(metric: String, comment_type: CommentType, desc: String) -> Self {
Comment {
metric,
comment_type,
description: desc,
}
}
}