Struct dipstick::LineTemplate
source · pub struct LineTemplate { /* private fields */ }
Expand description
An sequence of print commands, embodying an output strategy for a single metric.
Implementations§
source§impl LineTemplate
impl LineTemplate
sourcepub fn new(ops: Vec<LineOp>) -> Self
pub fn new(ops: Vec<LineOp>) -> Self
Make a new LineTemplate
Examples found in repository?
examples/text_format_label.rs (lines 15-28)
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
fn template(&self, name: &MetricName, _kind: InputKind) -> LineTemplate {
LineTemplate::new(vec![
LineOp::Literal(format!("{} ", name.join(".")).to_uppercase().into()),
LineOp::ValueAsText,
LineOp::Literal(" ".into()),
LineOp::LabelExists(
"abc".into(),
vec![
LabelOp::LabelKey,
LabelOp::Literal(":".into()),
LabelOp::LabelValue,
],
),
LineOp::NewLine,
])
}