[][src]Struct glean_core::metrics::CounterMetric

pub struct CounterMetric { /* fields omitted */ }

A counter metric.

Used to count things. The value can only be incremented, not decremented.

Methods

impl CounterMetric[src]

pub fn new(meta: CommonMetricData) -> Self[src]

Create a new counter metric.

pub fn add(&self, glean: &Glean, amount: i32)[src]

Increase the counter by amount.

Arguments

  • glean - The Glean instance this metric belongs to.
  • amount - The amount to increase by. Should be positive.

Notes

Logs an error if the amount is 0 or negative.

pub fn test_get_value(&self, glean: &Glean, storage_name: &str) -> Option<i32>[src]

Test-only API (exported for FFI purposes).

Get the currently stored value as an integer.

This doesn't clear the stored value.

Trait Implementations

impl MetricType for CounterMetric[src]

impl Clone for CounterMetric[src]

impl Debug for CounterMetric[src]

Auto Trait Implementations

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,