Struct metrics_util::MetricKindMask
source · [−]pub struct MetricKindMask(_);
Expand description
Metric kind mask.
Useful for matching against a kind, or kinds, of metrics.
In order to use for defining multiple metric kinds, can be used in a bitmask fashion, as this
type implements bitwise OR support, and checking for inclusion of a specific kind within another
kind value can be checked via matches
:
// Let's only match counters and histograms:
let mask = MetricKindMask::COUNTER | MetricKindMask::HISTOGRAM;
// And check to see if the kinds we have matches our mask:
assert!(!mask.matches(MetricKind::Gauge));
assert!(mask.matches(MetricKind::Counter));
// There's even two handy versions to avoid extra typing:
let none_mask = MetricKindMask::NONE;
let all_mask = MetricKindMask::ALL;
assert!(!none_mask.matches(MetricKind::Counter));
assert!(!none_mask.matches(MetricKind::Gauge));
assert!(!none_mask.matches(MetricKind::Histogram));
assert!(all_mask.matches(MetricKind::Counter));
assert!(all_mask.matches(MetricKind::Gauge));
assert!(all_mask.matches(MetricKind::Histogram));
Implementations
No metric kinds.
The counter kind.
The gauge kind.
The histogram kind.
All metric kinds.
Whether or not this metric kind contains the specified kind.
Trait Implementations
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Auto Trait Implementations
impl RefUnwindSafe for MetricKindMask
impl Send for MetricKindMask
impl Sync for MetricKindMask
impl Unpin for MetricKindMask
impl UnwindSafe for MetricKindMask
Blanket Implementations
Mutably borrows from an owned value. Read more
Compare self to key
and return true
if they are equal.