pub struct Number(/* private fields */);
Available on crate feature
metrics
only.Expand description
Number represents either an integral or a floating point value. It needs to be accompanied with a source of NumberKind that describes the actual type of the value stored within Number.
Implementations§
Source§impl Number
impl Number
Sourcepub fn to_atomic(&self) -> AtomicNumber
pub fn to_atomic(&self) -> AtomicNumber
Create an atomic version of the current number
Sourcepub fn partial_cmp(
&self,
number_kind: &NumberKind,
other: &Number,
) -> Option<Ordering>
pub fn partial_cmp( &self, number_kind: &NumberKind, other: &Number, ) -> Option<Ordering>
Compares this number to the given other number. Both should be of the same kind.
Sourcepub fn to_i64(&self, number_kind: &NumberKind) -> i64
pub fn to_i64(&self, number_kind: &NumberKind) -> i64
Casts the number to i64
. May result in data/precision loss.
Sourcepub fn to_f64(&self, number_kind: &NumberKind) -> f64
pub fn to_f64(&self, number_kind: &NumberKind) -> f64
Casts the number to f64
. May result in data/precision loss.
Sourcepub fn to_u64(&self, number_kind: &NumberKind) -> u64
pub fn to_u64(&self, number_kind: &NumberKind) -> u64
Casts the number to u64
. May result in data/precision loss.
Sourcepub fn is_nan(&self) -> bool
pub fn is_nan(&self) -> bool
Checks if this value ia an f64 nan value. Do not use on non-f64 values.
Sourcepub fn is_negative(&self, number_kind: &NumberKind) -> bool
pub fn is_negative(&self, number_kind: &NumberKind) -> bool
true
if the actual value is less than zero.
Sourcepub fn to_debug(&self, kind: &NumberKind) -> Box<dyn Debug>
pub fn to_debug(&self, kind: &NumberKind) -> Box<dyn Debug>
Return loaded data for debugging purposes
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Number
impl RefUnwindSafe for Number
impl Send for Number
impl Sync for Number
impl Unpin for Number
impl UnwindSafe for Number
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Available on crate feature
trace
only.Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Available on crate feature
trace
only.