rerun::external::eframe::egui::epaint::emath

Trait Numeric

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§

const INTEGRAL: bool

Is this an integer type?

const MIN: Self

Smallest finite value

const MAX: Self

Largest finite value

Required Methods§

fn to_f64(self) -> f64

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§

§

impl Numeric for f32

§

const INTEGRAL: bool = false

§

const MIN: f32 = -3.40282347E+38f32

§

const MAX: f32 = 3.40282347E+38f32

§

fn to_f64(self) -> f64

§

fn from_f64(num: f64) -> f32

§

impl Numeric for f64

§

const INTEGRAL: bool = false

§

const MIN: f64 = -1.7976931348623157E+308f64

§

const MAX: f64 = 1.7976931348623157E+308f64

§

fn to_f64(self) -> f64

§

fn from_f64(num: f64) -> f64

§

impl Numeric for i8

§

const INTEGRAL: bool = true

§

const MIN: i8 = -128i8

§

const MAX: i8 = 127i8

§

fn to_f64(self) -> f64

§

fn from_f64(num: f64) -> i8

§

impl Numeric for i16

§

const INTEGRAL: bool = true

§

const MIN: i16 = -32_768i16

§

const MAX: i16 = 32_767i16

§

fn to_f64(self) -> f64

§

fn from_f64(num: f64) -> i16

§

impl Numeric for i32

§

const INTEGRAL: bool = true

§

const MIN: i32 = -2_147_483_648i32

§

const MAX: i32 = 2_147_483_647i32

§

fn to_f64(self) -> f64

§

fn from_f64(num: f64) -> i32

§

impl Numeric for i64

§

const INTEGRAL: bool = true

§

const MIN: i64 = -9_223_372_036_854_775_808i64

§

const MAX: i64 = 9_223_372_036_854_775_807i64

§

fn to_f64(self) -> f64

§

fn from_f64(num: f64) -> i64

§

impl Numeric for isize

§

const INTEGRAL: bool = true

§

const MIN: isize = -9_223_372_036_854_775_808isize

§

const MAX: isize = 9_223_372_036_854_775_807isize

§

fn to_f64(self) -> f64

§

fn from_f64(num: f64) -> isize

§

impl Numeric for u8

§

const INTEGRAL: bool = true

§

const MIN: u8 = 0u8

§

const MAX: u8 = 255u8

§

fn to_f64(self) -> f64

§

fn from_f64(num: f64) -> u8

§

impl Numeric for u16

§

const INTEGRAL: bool = true

§

const MIN: u16 = 0u16

§

const MAX: u16 = 65_535u16

§

fn to_f64(self) -> f64

§

fn from_f64(num: f64) -> u16

§

impl Numeric for u32

§

const INTEGRAL: bool = true

§

const MIN: u32 = 0u32

§

const MAX: u32 = 4_294_967_295u32

§

fn to_f64(self) -> f64

§

fn from_f64(num: f64) -> u32

§

impl Numeric for u64

§

const INTEGRAL: bool = true

§

const MIN: u64 = 0u64

§

const MAX: u64 = 18_446_744_073_709_551_615u64

§

fn to_f64(self) -> f64

§

fn from_f64(num: f64) -> u64

§

impl Numeric for usize

§

const INTEGRAL: bool = true

§

const MIN: usize = 0usize

§

const MAX: usize = 18_446_744_073_709_551_615usize

§

fn to_f64(self) -> f64

§

fn from_f64(num: f64) -> usize

§

impl Numeric for NonZero<u8>

§

const INTEGRAL: bool = true

§

const MIN: NonZero<u8> = Self::MIN

§

const MAX: NonZero<u8> = Self::MAX

§

fn to_f64(self) -> f64

§

fn from_f64(num: f64) -> NonZero<u8>

§

impl Numeric for NonZero<u16>

§

const INTEGRAL: bool = true

§

const MIN: NonZero<u16> = Self::MIN

§

const MAX: NonZero<u16> = Self::MAX

§

fn to_f64(self) -> f64

§

fn from_f64(num: f64) -> NonZero<u16>

§

impl Numeric for NonZero<u32>

§

const INTEGRAL: bool = true

§

const MIN: NonZero<u32> = Self::MIN

§

const MAX: NonZero<u32> = Self::MAX

§

fn to_f64(self) -> f64

§

fn from_f64(num: f64) -> NonZero<u32>

§

impl Numeric for NonZero<u64>

§

const INTEGRAL: bool = true

§

const MIN: NonZero<u64> = Self::MIN

§

const MAX: NonZero<u64> = Self::MAX

§

fn to_f64(self) -> f64

§

fn from_f64(num: f64) -> NonZero<u64>

§

impl Numeric for NonZero<u128>

§

const INTEGRAL: bool = true

§

const MIN: NonZero<u128> = Self::MIN

§

const MAX: NonZero<u128> = Self::MAX

§

fn to_f64(self) -> f64

§

fn from_f64(num: f64) -> NonZero<u128>

§

impl Numeric for NonZero<usize>

§

const INTEGRAL: bool = true

§

const MIN: NonZero<usize> = Self::MIN

§

const MAX: NonZero<usize> = Self::MAX

§

fn to_f64(self) -> f64

§

fn from_f64(num: f64) -> NonZero<usize>

Implementors§