Skip to main content

Numeric

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;
}
Available on crate feature egui only.
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".

Implementations on Foreign Types§

Source§

impl Numeric for NonZero<u8>

Source§

const INTEGRAL: bool = true

Source§

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

Source§

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

Source§

fn to_f64(self) -> f64

Source§

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

Source§

impl Numeric for NonZero<u16>

Source§

const INTEGRAL: bool = true

Source§

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

Source§

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

Source§

fn to_f64(self) -> f64

Source§

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

Source§

impl Numeric for NonZero<u32>

Source§

const INTEGRAL: bool = true

Source§

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

Source§

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

Source§

fn to_f64(self) -> f64

Source§

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

Source§

impl Numeric for NonZero<u64>

Source§

const INTEGRAL: bool = true

Source§

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

Source§

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

Source§

fn to_f64(self) -> f64

Source§

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

Source§

impl Numeric for NonZero<u128>

Source§

const INTEGRAL: bool = true

Source§

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

Source§

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

Source§

fn to_f64(self) -> f64

Source§

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

Source§

impl Numeric for NonZero<usize>

Source§

const INTEGRAL: bool = true

Source§

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

Source§

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

Source§

fn to_f64(self) -> f64

Source§

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

Source§

impl Numeric for f32

Source§

const INTEGRAL: bool = false

Source§

const MIN: f32 = f32::MIN

Source§

const MAX: f32 = f32::MAX

Source§

fn to_f64(self) -> f64

Source§

fn from_f64(num: f64) -> f32

Source§

impl Numeric for f64

Source§

const INTEGRAL: bool = false

Source§

const MIN: f64 = f64::MIN

Source§

const MAX: f64 = f64::MAX

Source§

fn to_f64(self) -> f64

Source§

fn from_f64(num: f64) -> f64

Source§

impl Numeric for i8

Source§

const INTEGRAL: bool = true

Source§

const MIN: i8 = i8::MIN

Source§

const MAX: i8 = i8::MAX

Source§

fn to_f64(self) -> f64

Source§

fn from_f64(num: f64) -> i8

Source§

impl Numeric for i16

Source§

const INTEGRAL: bool = true

Source§

const MIN: i16 = i16::MIN

Source§

const MAX: i16 = i16::MAX

Source§

fn to_f64(self) -> f64

Source§

fn from_f64(num: f64) -> i16

Source§

impl Numeric for i32

Source§

const INTEGRAL: bool = true

Source§

const MIN: i32 = i32::MIN

Source§

const MAX: i32 = i32::MAX

Source§

fn to_f64(self) -> f64

Source§

fn from_f64(num: f64) -> i32

Source§

impl Numeric for i64

Source§

const INTEGRAL: bool = true

Source§

const MIN: i64 = i64::MIN

Source§

const MAX: i64 = i64::MAX

Source§

fn to_f64(self) -> f64

Source§

fn from_f64(num: f64) -> i64

Source§

impl Numeric for isize

Source§

const INTEGRAL: bool = true

Source§

const MIN: isize = isize::MIN

Source§

const MAX: isize = isize::MAX

Source§

fn to_f64(self) -> f64

Source§

fn from_f64(num: f64) -> isize

Source§

impl Numeric for u8

Source§

const INTEGRAL: bool = true

Source§

const MIN: u8 = u8::MIN

Source§

const MAX: u8 = u8::MAX

Source§

fn to_f64(self) -> f64

Source§

fn from_f64(num: f64) -> u8

Source§

impl Numeric for u16

Source§

const INTEGRAL: bool = true

Source§

const MIN: u16 = u16::MIN

Source§

const MAX: u16 = u16::MAX

Source§

fn to_f64(self) -> f64

Source§

fn from_f64(num: f64) -> u16

Source§

impl Numeric for u32

Source§

const INTEGRAL: bool = true

Source§

const MIN: u32 = u32::MIN

Source§

const MAX: u32 = u32::MAX

Source§

fn to_f64(self) -> f64

Source§

fn from_f64(num: f64) -> u32

Source§

impl Numeric for u64

Source§

const INTEGRAL: bool = true

Source§

const MIN: u64 = u64::MIN

Source§

const MAX: u64 = u64::MAX

Source§

fn to_f64(self) -> f64

Source§

fn from_f64(num: f64) -> u64

Source§

impl Numeric for usize

Source§

const INTEGRAL: bool = true

Source§

const MIN: usize = usize::MIN

Source§

const MAX: usize = usize::MAX

Source§

fn to_f64(self) -> f64

Source§

fn from_f64(num: f64) -> usize

Implementors§