emath

Trait 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

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so 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§