Trait numfmt::Numeric

source ·
pub trait Numeric {
    // Required method
    fn to_f64(&self) -> f64;

    // Provided methods
    fn is_nan(&self) -> bool { ... }
    fn is_negative(&self) -> bool { ... }
    fn is_infinite(&self) -> bool { ... }
    fn is_zero(&self) -> bool { ... }
}
Expand description

An object is representable as a 64-bit floating point number.

Required Methods§

source

fn to_f64(&self) -> f64

Perform the conversion.

Provided Methods§

source

fn is_nan(&self) -> bool

Return if the number is NaN.

The default implementation converts to f64 and performs the test.

source

fn is_negative(&self) -> bool

Return if the number is negative.

The default implementation converts to f64 and performs the test.

source

fn is_infinite(&self) -> bool

Return if the number is infinite.

The default implementation converts to f64 and performs the test.

source

fn is_zero(&self) -> bool

Return if the number is zero.

The default implementation converts to f64 and performs the test.

Implementations on Foreign Types§

source§

impl Numeric for i128

source§

fn to_f64(&self) -> f64

source§

fn is_nan(&self) -> bool

source§

fn is_negative(&self) -> bool

source§

fn is_infinite(&self) -> bool

source§

fn is_zero(&self) -> bool

source§

impl Numeric for u8

source§

fn to_f64(&self) -> f64

source§

fn is_nan(&self) -> bool

source§

fn is_negative(&self) -> bool

source§

fn is_infinite(&self) -> bool

source§

fn is_zero(&self) -> bool

source§

impl Numeric for usize

source§

fn to_f64(&self) -> f64

source§

fn is_nan(&self) -> bool

source§

fn is_negative(&self) -> bool

source§

fn is_infinite(&self) -> bool

source§

fn is_zero(&self) -> bool

source§

impl Numeric for u32

source§

fn to_f64(&self) -> f64

source§

fn is_nan(&self) -> bool

source§

fn is_negative(&self) -> bool

source§

fn is_infinite(&self) -> bool

source§

fn is_zero(&self) -> bool

source§

impl Numeric for i64

source§

fn to_f64(&self) -> f64

source§

fn is_nan(&self) -> bool

source§

fn is_negative(&self) -> bool

source§

fn is_infinite(&self) -> bool

source§

fn is_zero(&self) -> bool

source§

impl Numeric for i8

source§

fn to_f64(&self) -> f64

source§

fn is_nan(&self) -> bool

source§

fn is_negative(&self) -> bool

source§

fn is_infinite(&self) -> bool

source§

fn is_zero(&self) -> bool

source§

impl Numeric for i32

source§

fn to_f64(&self) -> f64

source§

fn is_nan(&self) -> bool

source§

fn is_negative(&self) -> bool

source§

fn is_infinite(&self) -> bool

source§

fn is_zero(&self) -> bool

source§

impl Numeric for u64

source§

fn to_f64(&self) -> f64

source§

fn is_nan(&self) -> bool

source§

fn is_negative(&self) -> bool

source§

fn is_infinite(&self) -> bool

source§

fn is_zero(&self) -> bool

source§

impl Numeric for u16

source§

fn to_f64(&self) -> f64

source§

fn is_nan(&self) -> bool

source§

fn is_negative(&self) -> bool

source§

fn is_infinite(&self) -> bool

source§

fn is_zero(&self) -> bool

source§

impl Numeric for f64

source§

fn to_f64(&self) -> f64

source§

fn is_nan(&self) -> bool

source§

fn is_negative(&self) -> bool

source§

fn is_infinite(&self) -> bool

source§

fn is_zero(&self) -> bool

source§

impl Numeric for u128

source§

fn to_f64(&self) -> f64

source§

fn is_nan(&self) -> bool

source§

fn is_negative(&self) -> bool

source§

fn is_infinite(&self) -> bool

source§

fn is_zero(&self) -> bool

source§

impl Numeric for i16

source§

fn to_f64(&self) -> f64

source§

fn is_nan(&self) -> bool

source§

fn is_negative(&self) -> bool

source§

fn is_infinite(&self) -> bool

source§

fn is_zero(&self) -> bool

source§

impl Numeric for isize

source§

fn to_f64(&self) -> f64

source§

fn is_nan(&self) -> bool

source§

fn is_negative(&self) -> bool

source§

fn is_infinite(&self) -> bool

source§

fn is_zero(&self) -> bool

source§

impl Numeric for f32

source§

fn to_f64(&self) -> f64

source§

fn is_nan(&self) -> bool

source§

fn is_negative(&self) -> bool

source§

fn is_infinite(&self) -> bool

source§

fn is_zero(&self) -> bool

Implementors§