Trait prometheus::core::Number

source ·
pub trait Number: Sized + AddAssign + SubAssign + PartialOrd + PartialEq + Copy + Send + Sync {
    // Required methods
    fn from_i64(v: i64) -> Self;
    fn into_f64(self) -> f64;
}
Expand description

An interface for numbers. Used to generically model float metrics and integer metrics, i.e. Counter and IntCounter.

Required Methods§

source

fn from_i64(v: i64) -> Self

std::convert::From<i64> for f64 is not implemented, so that we need to implement our own.

source

fn into_f64(self) -> f64

Convert to a f64.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl Number for f64

source§

fn from_i64(v: i64) -> Self

source§

fn into_f64(self) -> f64

source§

impl Number for i64

source§

fn from_i64(v: i64) -> Self

source§

fn into_f64(self) -> f64

source§

impl Number for u64

source§

fn from_i64(v: i64) -> Self

source§

fn into_f64(self) -> f64

Implementors§