Skip to main content

Number

Trait Number 

Source
pub trait Number:
    NumberLike
    + LowerExp
    + UpperExp
    + Add<Self, Output = Self>
    + for<'a> Add<&'a Self, Output = Self>
    + AddAssign<Self>
    + for<'a> AddAssign<&'a Self>
    + Sub<Self, Output = Self>
    + for<'a> Sub<&'a Self, Output = Self>
    + SubAssign<Self>
    + for<'a> SubAssign<&'a Self>
    + Mul<Self, Output = Self>
    + for<'a> Mul<&'a Self, Output = Self>
    + MulAssign<Self>
    + for<'a> MulAssign<&'a Self>
    + Div<Self, Output = Self>
    + for<'a> Div<&'a Self, Output = Self>
    + DivAssign<Self>
    + for<'a> DivAssign<&'a Self>
    + Rem<Self, Output = Self>
    + for<'a> Rem<&'a Self, Output = Self>
    + RemAssign<Self>
    + for<'a> RemAssign<&'a Self>
    + From<bool>
    + TryFrom<u8>
    + TryFrom<u16>
    + TryFrom<i8>
    + TryFrom<i16>
    + Sum
    + Product {
    const ZERO: Self;
    const ONE: Self;
    const TWO: Self;

    // Required methods
    fn from_bytes(bytes: Self::ByteArray) -> Self;
    fn as_mut_bytes(&mut self) -> &mut Self::ByteArray;
    fn from_be_bytes(bytes: Self::ByteArray) -> Self;
    fn from_le_bytes(bytes: Self::ByteArray) -> Self;
    fn from_ne_bytes(bytes: Self::ByteArray) -> Self;
    fn cast_f32(self) -> f32;
    fn cast_f64(self) -> f64;
    fn abs(self) -> Self;
    fn signum(self) -> Self;
    fn div_euclid(self, rhs: Self) -> Self;
    fn rem_euclid(self, rhs: Self) -> Self;
}

Required Associated Constants§

Source

const ZERO: Self

Source

const ONE: Self

Source

const TWO: Self

Required Methods§

Source

fn from_bytes(bytes: Self::ByteArray) -> Self

Source

fn as_mut_bytes(&mut self) -> &mut Self::ByteArray

Source

fn from_be_bytes(bytes: Self::ByteArray) -> Self

Source

fn from_le_bytes(bytes: Self::ByteArray) -> Self

Source

fn from_ne_bytes(bytes: Self::ByteArray) -> Self

Source

fn cast_f32(self) -> f32

Source

fn cast_f64(self) -> f64

Source

fn abs(self) -> Self

See i32::abs.

Source

fn signum(self) -> Self

Source

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

Source

fn rem_euclid(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 TWO: Self

Source§

fn from_bytes(bytes: Self::ByteArray) -> Self

Source§

fn as_mut_bytes(&mut self) -> &mut Self::ByteArray

Source§

fn from_be_bytes(bytes: Self::ByteArray) -> Self

Source§

fn from_le_bytes(bytes: Self::ByteArray) -> Self

Source§

fn from_ne_bytes(bytes: Self::ByteArray) -> Self

Source§

fn cast_f32(self) -> f32

Source§

fn cast_f64(self) -> f64

Source§

fn abs(self) -> Self

Source§

fn signum(self) -> Self

Source§

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

Source§

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

Source§

impl Number for f64

Source§

const ZERO: Self = 0.0

Source§

const ONE: Self = 1.0

Source§

const TWO: Self

Source§

fn from_bytes(bytes: Self::ByteArray) -> Self

Source§

fn as_mut_bytes(&mut self) -> &mut Self::ByteArray

Source§

fn from_be_bytes(bytes: Self::ByteArray) -> Self

Source§

fn from_le_bytes(bytes: Self::ByteArray) -> Self

Source§

fn from_ne_bytes(bytes: Self::ByteArray) -> Self

Source§

fn cast_f32(self) -> f32

Source§

fn cast_f64(self) -> f64

Source§

fn abs(self) -> Self

Source§

fn signum(self) -> Self

Source§

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

Source§

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

Source§

impl Number for i8

Source§

const ZERO: Self = 0

Source§

const ONE: Self = 1

Source§

const TWO: Self

Source§

fn from_bytes(bytes: Self::ByteArray) -> Self

Source§

fn as_mut_bytes(&mut self) -> &mut Self::ByteArray

Source§

fn from_be_bytes(bytes: Self::ByteArray) -> Self

Source§

fn from_le_bytes(bytes: Self::ByteArray) -> Self

Source§

fn from_ne_bytes(bytes: Self::ByteArray) -> Self

Source§

fn cast_f32(self) -> f32

Source§

fn cast_f64(self) -> f64

Source§

fn abs(self) -> Self

Source§

fn signum(self) -> Self

Source§

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

Source§

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

Source§

impl Number for i16

Source§

const ZERO: Self = 0

Source§

const ONE: Self = 1

Source§

const TWO: Self

Source§

fn from_bytes(bytes: Self::ByteArray) -> Self

Source§

fn as_mut_bytes(&mut self) -> &mut Self::ByteArray

Source§

fn from_be_bytes(bytes: Self::ByteArray) -> Self

Source§

fn from_le_bytes(bytes: Self::ByteArray) -> Self

Source§

fn from_ne_bytes(bytes: Self::ByteArray) -> Self

Source§

fn cast_f32(self) -> f32

Source§

fn cast_f64(self) -> f64

Source§

fn abs(self) -> Self

Source§

fn signum(self) -> Self

Source§

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

Source§

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

Source§

impl Number for i32

Source§

const ZERO: Self = 0

Source§

const ONE: Self = 1

Source§

const TWO: Self

Source§

fn from_bytes(bytes: Self::ByteArray) -> Self

Source§

fn as_mut_bytes(&mut self) -> &mut Self::ByteArray

Source§

fn from_be_bytes(bytes: Self::ByteArray) -> Self

Source§

fn from_le_bytes(bytes: Self::ByteArray) -> Self

Source§

fn from_ne_bytes(bytes: Self::ByteArray) -> Self

Source§

fn cast_f32(self) -> f32

Source§

fn cast_f64(self) -> f64

Source§

fn abs(self) -> Self

Source§

fn signum(self) -> Self

Source§

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

Source§

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

Source§

impl Number for i64

Source§

const ZERO: Self = 0

Source§

const ONE: Self = 1

Source§

const TWO: Self

Source§

fn from_bytes(bytes: Self::ByteArray) -> Self

Source§

fn as_mut_bytes(&mut self) -> &mut Self::ByteArray

Source§

fn from_be_bytes(bytes: Self::ByteArray) -> Self

Source§

fn from_le_bytes(bytes: Self::ByteArray) -> Self

Source§

fn from_ne_bytes(bytes: Self::ByteArray) -> Self

Source§

fn cast_f32(self) -> f32

Source§

fn cast_f64(self) -> f64

Source§

fn abs(self) -> Self

Source§

fn signum(self) -> Self

Source§

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

Source§

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

Source§

impl Number for i128

Source§

const ZERO: Self = 0

Source§

const ONE: Self = 1

Source§

const TWO: Self

Source§

fn from_bytes(bytes: Self::ByteArray) -> Self

Source§

fn as_mut_bytes(&mut self) -> &mut Self::ByteArray

Source§

fn from_be_bytes(bytes: Self::ByteArray) -> Self

Source§

fn from_le_bytes(bytes: Self::ByteArray) -> Self

Source§

fn from_ne_bytes(bytes: Self::ByteArray) -> Self

Source§

fn cast_f32(self) -> f32

Source§

fn cast_f64(self) -> f64

Source§

fn abs(self) -> Self

Source§

fn signum(self) -> Self

Source§

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

Source§

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

Source§

impl Number for isize

Source§

const ZERO: Self = 0

Source§

const ONE: Self = 1

Source§

const TWO: Self

Source§

fn from_bytes(bytes: Self::ByteArray) -> Self

Source§

fn as_mut_bytes(&mut self) -> &mut Self::ByteArray

Source§

fn from_be_bytes(bytes: Self::ByteArray) -> Self

Source§

fn from_le_bytes(bytes: Self::ByteArray) -> Self

Source§

fn from_ne_bytes(bytes: Self::ByteArray) -> Self

Source§

fn cast_f32(self) -> f32

Source§

fn cast_f64(self) -> f64

Source§

fn abs(self) -> Self

Source§

fn signum(self) -> Self

Source§

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

Source§

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

Source§

impl Number for u8

Source§

const ZERO: Self = 0

Source§

const ONE: Self = 1

Source§

const TWO: Self

Source§

fn from_bytes(bytes: Self::ByteArray) -> Self

Source§

fn as_mut_bytes(&mut self) -> &mut Self::ByteArray

Source§

fn from_be_bytes(bytes: Self::ByteArray) -> Self

Source§

fn from_le_bytes(bytes: Self::ByteArray) -> Self

Source§

fn from_ne_bytes(bytes: Self::ByteArray) -> Self

Source§

fn cast_f32(self) -> f32

Source§

fn cast_f64(self) -> f64

Source§

fn abs(self) -> Self

Source§

fn signum(self) -> Self

Source§

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

Source§

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

Source§

impl Number for u16

Source§

const ZERO: Self = 0

Source§

const ONE: Self = 1

Source§

const TWO: Self

Source§

fn from_bytes(bytes: Self::ByteArray) -> Self

Source§

fn as_mut_bytes(&mut self) -> &mut Self::ByteArray

Source§

fn from_be_bytes(bytes: Self::ByteArray) -> Self

Source§

fn from_le_bytes(bytes: Self::ByteArray) -> Self

Source§

fn from_ne_bytes(bytes: Self::ByteArray) -> Self

Source§

fn cast_f32(self) -> f32

Source§

fn cast_f64(self) -> f64

Source§

fn abs(self) -> Self

Source§

fn signum(self) -> Self

Source§

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

Source§

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

Source§

impl Number for u32

Source§

const ZERO: Self = 0

Source§

const ONE: Self = 1

Source§

const TWO: Self

Source§

fn from_bytes(bytes: Self::ByteArray) -> Self

Source§

fn as_mut_bytes(&mut self) -> &mut Self::ByteArray

Source§

fn from_be_bytes(bytes: Self::ByteArray) -> Self

Source§

fn from_le_bytes(bytes: Self::ByteArray) -> Self

Source§

fn from_ne_bytes(bytes: Self::ByteArray) -> Self

Source§

fn cast_f32(self) -> f32

Source§

fn cast_f64(self) -> f64

Source§

fn abs(self) -> Self

Source§

fn signum(self) -> Self

Source§

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

Source§

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

Source§

impl Number for u64

Source§

const ZERO: Self = 0

Source§

const ONE: Self = 1

Source§

const TWO: Self

Source§

fn from_bytes(bytes: Self::ByteArray) -> Self

Source§

fn as_mut_bytes(&mut self) -> &mut Self::ByteArray

Source§

fn from_be_bytes(bytes: Self::ByteArray) -> Self

Source§

fn from_le_bytes(bytes: Self::ByteArray) -> Self

Source§

fn from_ne_bytes(bytes: Self::ByteArray) -> Self

Source§

fn cast_f32(self) -> f32

Source§

fn cast_f64(self) -> f64

Source§

fn abs(self) -> Self

Source§

fn signum(self) -> Self

Source§

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

Source§

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

Source§

impl Number for u128

Source§

const ZERO: Self = 0

Source§

const ONE: Self = 1

Source§

const TWO: Self

Source§

fn from_bytes(bytes: Self::ByteArray) -> Self

Source§

fn as_mut_bytes(&mut self) -> &mut Self::ByteArray

Source§

fn from_be_bytes(bytes: Self::ByteArray) -> Self

Source§

fn from_le_bytes(bytes: Self::ByteArray) -> Self

Source§

fn from_ne_bytes(bytes: Self::ByteArray) -> Self

Source§

fn cast_f32(self) -> f32

Source§

fn cast_f64(self) -> f64

Source§

fn abs(self) -> Self

Source§

fn signum(self) -> Self

Source§

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

Source§

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

Source§

impl Number for usize

Source§

const ZERO: Self = 0

Source§

const ONE: Self = 1

Source§

const TWO: Self

Source§

fn from_bytes(bytes: Self::ByteArray) -> Self

Source§

fn as_mut_bytes(&mut self) -> &mut Self::ByteArray

Source§

fn from_be_bytes(bytes: Self::ByteArray) -> Self

Source§

fn from_le_bytes(bytes: Self::ByteArray) -> Self

Source§

fn from_ne_bytes(bytes: Self::ByteArray) -> Self

Source§

fn cast_f32(self) -> f32

Source§

fn cast_f64(self) -> f64

Source§

fn abs(self) -> Self

Source§

fn signum(self) -> Self

Source§

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

Source§

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

Implementors§