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§

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,
        ])
    }

Template execution applies commands in turn, writing to the output.

Trait Implementations§

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.