Trait emath::numeric::Numeric

source ·
pub trait Numeric: Clone + Copy + PartialEq + PartialOrd + 'static {
    const INTEGRAL: bool;
    const MIN: Self;
    const MAX: Self;

    // Required methods
    fn to_f64(self) -> f64;
    fn from_f64(num: f64) -> Self;
}
Expand description

Implemented for all builtin numeric types

Required Associated Constants§

source

const INTEGRAL: bool

Is this an integer type?

source

const MIN: Self

Smallest finite value

source

const MAX: Self

Largest finite value

Required Methods§

source

fn to_f64(self) -> f64

source

fn from_f64(num: f64) -> Self

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl Numeric for f32

source§

const INTEGRAL: bool = false

source§

const MIN: Self = -3.40282347E+38f32

source§

const MAX: Self = 3.40282347E+38f32

source§

fn to_f64(self) -> f64

source§

fn from_f64(num: f64) -> Self

source§

impl Numeric for f64

source§

const INTEGRAL: bool = false

source§

const MIN: Self = -1.7976931348623157E+308f64

source§

const MAX: Self = 1.7976931348623157E+308f64

source§

fn to_f64(self) -> f64

source§

fn from_f64(num: f64) -> Self

source§

impl Numeric for i8

source§

const INTEGRAL: bool = true

source§

const MIN: Self = -128i8

source§

const MAX: Self = 127i8

source§

fn to_f64(self) -> f64

source§

fn from_f64(num: f64) -> Self

source§

impl Numeric for i16

source§

const INTEGRAL: bool = true

source§

const MIN: Self = -32_768i16

source§

const MAX: Self = 32_767i16

source§

fn to_f64(self) -> f64

source§

fn from_f64(num: f64) -> Self

source§

impl Numeric for i32

source§

const INTEGRAL: bool = true

source§

const MIN: Self = -2_147_483_648i32

source§

const MAX: Self = 2_147_483_647i32

source§

fn to_f64(self) -> f64

source§

fn from_f64(num: f64) -> Self

source§

impl Numeric for i64

source§

const INTEGRAL: bool = true

source§

const MIN: Self = -9_223_372_036_854_775_808i64

source§

const MAX: Self = 9_223_372_036_854_775_807i64

source§

fn to_f64(self) -> f64

source§

fn from_f64(num: f64) -> Self

source§

impl Numeric for isize

source§

const INTEGRAL: bool = true

source§

const MIN: Self = -9_223_372_036_854_775_808isize

source§

const MAX: Self = 9_223_372_036_854_775_807isize

source§

fn to_f64(self) -> f64

source§

fn from_f64(num: f64) -> Self

source§

impl Numeric for u8

source§

const INTEGRAL: bool = true

source§

const MIN: Self = 0u8

source§

const MAX: Self = 255u8

source§

fn to_f64(self) -> f64

source§

fn from_f64(num: f64) -> Self

source§

impl Numeric for u16

source§

const INTEGRAL: bool = true

source§

const MIN: Self = 0u16

source§

const MAX: Self = 65_535u16

source§

fn to_f64(self) -> f64

source§

fn from_f64(num: f64) -> Self

source§

impl Numeric for u32

source§

const INTEGRAL: bool = true

source§

const MIN: Self = 0u32

source§

const MAX: Self = 4_294_967_295u32

source§

fn to_f64(self) -> f64

source§

fn from_f64(num: f64) -> Self

source§

impl Numeric for u64

source§

const INTEGRAL: bool = true

source§

const MIN: Self = 0u64

source§

const MAX: Self = 18_446_744_073_709_551_615u64

source§

fn to_f64(self) -> f64

source§

fn from_f64(num: f64) -> Self

source§

impl Numeric for usize

source§

const INTEGRAL: bool = true

source§

const MIN: Self = 0usize

source§

const MAX: Self = 18_446_744_073_709_551_615usize

source§

fn to_f64(self) -> f64

source§

fn from_f64(num: f64) -> Self

source§

impl Numeric for NonZeroU8

source§

const INTEGRAL: bool = true

source§

const MIN: Self = Self::MIN

source§

const MAX: Self = Self::MAX

source§

fn to_f64(self) -> f64

source§

fn from_f64(num: f64) -> Self

source§

impl Numeric for NonZeroU16

source§

const INTEGRAL: bool = true

source§

const MIN: Self = Self::MIN

source§

const MAX: Self = Self::MAX

source§

fn to_f64(self) -> f64

source§

fn from_f64(num: f64) -> Self

source§

impl Numeric for NonZeroU32

source§

const INTEGRAL: bool = true

source§

const MIN: Self = Self::MIN

source§

const MAX: Self = Self::MAX

source§

fn to_f64(self) -> f64

source§

fn from_f64(num: f64) -> Self

source§

impl Numeric for NonZeroU64

source§

const INTEGRAL: bool = true

source§

const MIN: Self = Self::MIN

source§

const MAX: Self = Self::MAX

source§

fn to_f64(self) -> f64

source§

fn from_f64(num: f64) -> Self

source§

impl Numeric for NonZeroU128

source§

const INTEGRAL: bool = true

source§

const MIN: Self = Self::MIN

source§

const MAX: Self = Self::MAX

source§

fn to_f64(self) -> f64

source§

fn from_f64(num: f64) -> Self

source§

impl Numeric for NonZeroUsize

source§

const INTEGRAL: bool = true

source§

const MIN: Self = Self::MIN

source§

const MAX: Self = Self::MAX

source§

fn to_f64(self) -> f64

source§

fn from_f64(num: f64) -> Self

Implementors§