Number

Trait Number 

Source
pub trait Number:
    Copy
    + Debug
    + Default
    + PartialEq
    + PartialOrd
    + Add<Output = Self>
    + AddAssign
    + Div<Output = Self>
    + DivAssign
    + Mul<Output = Self>
    + MulAssign
    + Rem<Output = Self>
    + RemAssign
    + Sub<Output = Self>
    + SubAssign
    + Sum<Self>
    + for<'a> Sum<&'a Self>
    + Product<Self>
    + for<'a> Product<&'a Self> {
    const ZERO: Self;
    const ONE: Self;
    const MIN: Self;
    const MAX: Self;

    // Required methods
    fn abs(self) -> Self;
    fn rem_euclid(self, rhs: Self) -> Self;
    fn squared_diff(self, rhs: Self) -> Self;
}
Expand description

Trait implemented by the primitive number types, combining common supertraits.

Required Associated Constants§

Source

const ZERO: Self

Source

const ONE: Self

Source

const MIN: Self

Source

const MAX: Self

Required Methods§

Source

fn abs(self) -> Self

Source

fn rem_euclid(self, rhs: Self) -> Self

Source

fn squared_diff(self, rhs: Self) -> 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 Number for f32

Source§

const ZERO: Self = 0.0

Source§

const ONE: Self = 1.0

Source§

const MIN: Self = Self::NEG_INFINITY

Source§

const MAX: Self = Self::INFINITY

Source§

fn abs(self) -> Self

Source§

fn rem_euclid(self, rhs: Self) -> Self

Source§

fn squared_diff(self, rhs: Self) -> Self

Source§

impl Number for f64

Source§

const ZERO: Self = 0.0

Source§

const ONE: Self = 1.0

Source§

const MIN: Self = Self::NEG_INFINITY

Source§

const MAX: Self = Self::INFINITY

Source§

fn abs(self) -> Self

Source§

fn rem_euclid(self, rhs: Self) -> Self

Source§

fn squared_diff(self, rhs: Self) -> Self

Source§

impl Number for i8

Source§

const ZERO: Self = 0

Source§

const ONE: Self = 1

Source§

const MIN: Self = Self::MIN

Source§

const MAX: Self = Self::MAX

Source§

fn abs(self) -> Self

Source§

fn rem_euclid(self, rhs: Self) -> Self

Source§

fn squared_diff(self, rhs: Self) -> Self

Source§

impl Number for i16

Source§

const ZERO: Self = 0

Source§

const ONE: Self = 1

Source§

const MIN: Self = Self::MIN

Source§

const MAX: Self = Self::MAX

Source§

fn abs(self) -> Self

Source§

fn rem_euclid(self, rhs: Self) -> Self

Source§

fn squared_diff(self, rhs: Self) -> Self

Source§

impl Number for i32

Source§

const ZERO: Self = 0

Source§

const ONE: Self = 1

Source§

const MIN: Self = Self::MIN

Source§

const MAX: Self = Self::MAX

Source§

fn abs(self) -> Self

Source§

fn rem_euclid(self, rhs: Self) -> Self

Source§

fn squared_diff(self, rhs: Self) -> Self

Source§

impl Number for i64

Source§

const ZERO: Self = 0

Source§

const ONE: Self = 1

Source§

const MIN: Self = Self::MIN

Source§

const MAX: Self = Self::MAX

Source§

fn abs(self) -> Self

Source§

fn rem_euclid(self, rhs: Self) -> Self

Source§

fn squared_diff(self, rhs: Self) -> Self

Source§

impl Number for i128

Source§

const ZERO: Self = 0

Source§

const ONE: Self = 1

Source§

const MIN: Self = Self::MIN

Source§

const MAX: Self = Self::MAX

Source§

fn abs(self) -> Self

Source§

fn rem_euclid(self, rhs: Self) -> Self

Source§

fn squared_diff(self, rhs: Self) -> Self

Source§

impl Number for isize

Source§

const ZERO: Self = 0

Source§

const ONE: Self = 1

Source§

const MIN: Self = Self::MIN

Source§

const MAX: Self = Self::MAX

Source§

fn abs(self) -> Self

Source§

fn rem_euclid(self, rhs: Self) -> Self

Source§

fn squared_diff(self, rhs: Self) -> Self

Source§

impl Number for u8

Source§

const ZERO: Self = 0

Source§

const ONE: Self = 1

Source§

const MIN: Self = Self::MIN

Source§

const MAX: Self = Self::MAX

Source§

fn abs(self) -> Self

Source§

fn rem_euclid(self, rhs: Self) -> Self

Source§

fn squared_diff(self, rhs: Self) -> Self

Source§

impl Number for u16

Source§

const ZERO: Self = 0

Source§

const ONE: Self = 1

Source§

const MIN: Self = Self::MIN

Source§

const MAX: Self = Self::MAX

Source§

fn abs(self) -> Self

Source§

fn rem_euclid(self, rhs: Self) -> Self

Source§

fn squared_diff(self, rhs: Self) -> Self

Source§

impl Number for u32

Source§

const ZERO: Self = 0

Source§

const ONE: Self = 1

Source§

const MIN: Self = Self::MIN

Source§

const MAX: Self = Self::MAX

Source§

fn abs(self) -> Self

Source§

fn rem_euclid(self, rhs: Self) -> Self

Source§

fn squared_diff(self, rhs: Self) -> Self

Source§

impl Number for u64

Source§

const ZERO: Self = 0

Source§

const ONE: Self = 1

Source§

const MIN: Self = Self::MIN

Source§

const MAX: Self = Self::MAX

Source§

fn abs(self) -> Self

Source§

fn rem_euclid(self, rhs: Self) -> Self

Source§

fn squared_diff(self, rhs: Self) -> Self

Source§

impl Number for u128

Source§

const ZERO: Self = 0

Source§

const ONE: Self = 1

Source§

const MIN: Self = Self::MIN

Source§

const MAX: Self = Self::MAX

Source§

fn abs(self) -> Self

Source§

fn rem_euclid(self, rhs: Self) -> Self

Source§

fn squared_diff(self, rhs: Self) -> Self

Source§

impl Number for usize

Source§

const ZERO: Self = 0

Source§

const ONE: Self = 1

Source§

const MIN: Self = Self::MIN

Source§

const MAX: Self = Self::MAX

Source§

fn abs(self) -> Self

Source§

fn rem_euclid(self, rhs: Self) -> Self

Source§

fn squared_diff(self, rhs: Self) -> Self

Implementors§