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
sourceimpl MetricKindMask
 
impl MetricKindMask
sourcepub const NONE: MetricKindMask = _
 
pub const NONE: MetricKindMask = _
No metric kinds.
sourcepub const COUNTER: MetricKindMask = _
 
pub const COUNTER: MetricKindMask = _
The counter kind.
sourcepub const GAUGE: MetricKindMask = _
 
pub const GAUGE: MetricKindMask = _
The gauge kind.
sourcepub const HISTOGRAM: MetricKindMask = _
 
pub const HISTOGRAM: MetricKindMask = _
The histogram kind.
sourcepub const ALL: MetricKindMask = _
 
pub const ALL: MetricKindMask = _
All metric kinds.
sourcepub fn matches(&self, kind: MetricKind) -> bool
 
pub fn matches(&self, kind: MetricKind) -> bool
Whether or not this metric kind contains the specified kind.
Trait Implementations
sourceimpl BitOr<MetricKindMask> for MetricKindMask
 
impl BitOr<MetricKindMask> for MetricKindMask
sourceimpl Clone for MetricKindMask
 
impl Clone for MetricKindMask
sourcefn clone(&self) -> MetricKindMask
 
fn clone(&self) -> MetricKindMask
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
 
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl Debug for MetricKindMask
 
impl Debug for MetricKindMask
sourceimpl Hash for MetricKindMask
 
impl Hash for MetricKindMask
sourceimpl Ord for MetricKindMask
 
impl Ord for MetricKindMask
sourceimpl PartialEq<MetricKindMask> for MetricKindMask
 
impl PartialEq<MetricKindMask> for MetricKindMask
sourcefn eq(&self, other: &MetricKindMask) -> bool
 
fn eq(&self, other: &MetricKindMask) -> bool
This method tests for self and other values to be equal, and is used
by ==. Read more
sourcefn ne(&self, other: &MetricKindMask) -> bool
 
fn ne(&self, other: &MetricKindMask) -> bool
This method tests for !=.
sourceimpl PartialOrd<MetricKindMask> for MetricKindMask
 
impl PartialOrd<MetricKindMask> for MetricKindMask
sourcefn partial_cmp(&self, other: &MetricKindMask) -> Option<Ordering>
 
fn partial_cmp(&self, other: &MetricKindMask) -> Option<Ordering>
This method returns an ordering between self and other values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
 
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
 
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self and other) and is used by the <=
operator. Read more
impl Copy for MetricKindMask
impl Eq for MetricKindMask
impl StructuralEq for MetricKindMask
impl StructuralPartialEq for MetricKindMask
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
sourceimpl<T> BorrowMut<T> for T where
    T: ?Sized, 
 
impl<T> BorrowMut<T> for T where
    T: ?Sized, 
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
 
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Q where
    Q: Eq + ?Sized,
    K: Borrow<Q> + ?Sized, 
 
impl<Q, K> Equivalent<K> for Q where
    Q: Eq + ?Sized,
    K: Borrow<Q> + ?Sized, 
sourcefn equivalent(&self, key: &K) -> bool
 
fn equivalent(&self, key: &K) -> bool
Compare self to key and return true if they are equal.