pub struct Number(_);
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
sourceimpl 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.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Number
impl Send for Number
impl Sync for Number
impl Unpin for Number
impl UnwindSafe for Number
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
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