try_read_comment

Function try_read_comment 

Source
pub fn try_read_comment(line: &str) -> Option<Comment>
Expand description

Tries to parse a &str line as a comment and returns Comment if it succeeds.

ยงExamples:

use prometheus_wire::parser::{Comment, CommentType, try_read_comment};
assert_eq!(
    try_read_comment("# HELP test1 this is a test"),
    Some(Comment::new(String::from("test1"), CommentType::HELP, String::from("this is a test")))
);

assert_eq!(try_read_comment("metric 12345"), None);