Trait Number

Source
pub trait Number:
    NumberLike
    + LowerExp
    + UpperExp
    + Add<Self>
    + for<'a> Add<&'a Self>
    + AddAssign<Self>
    + for<'a> AddAssign<&'a Self>
    + Sub<Self>
    + for<'a> Sub<&'a Self>
    + SubAssign<Self>
    + for<'a> SubAssign<&'a Self>
    + Mul<Self>
    + for<'a> Mul<&'a Self>
    + MulAssign<Self>
    + for<'a> MulAssign<&'a Self>
    + Div<Self>
    + for<'a> Div<&'a Self>
    + DivAssign<Self>
    + for<'a> DivAssign<&'a Self>
    + Rem<Self>
    + for<'a> Rem<&'a Self>
    + RemAssign<Self>
    + for<'a> RemAssign<&'a Self>
    + 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 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 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 = 0f32

Source§

const ONE: Self = 1f32

Source§

const TWO: Self = 2f32

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 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 = 0f64

Source§

const ONE: Self = 1f64

Source§

const TWO: Self = 2f64

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 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 = 0i8

Source§

const ONE: Self = 1i8

Source§

const TWO: Self = 2i8

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 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 = 0i16

Source§

const ONE: Self = 1i16

Source§

const TWO: Self = 2i16

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 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 = 0i32

Source§

const ONE: Self = 1i32

Source§

const TWO: Self = 2i32

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 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 = 0i64

Source§

const ONE: Self = 1i64

Source§

const TWO: Self = 2i64

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 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 = 0i128

Source§

const ONE: Self = 1i128

Source§

const TWO: Self = 2i128

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 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 = 0isize

Source§

const ONE: Self = 1isize

Source§

const TWO: Self = 2isize

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 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 = 0u8

Source§

const ONE: Self = 1u8

Source§

const TWO: Self = 2u8

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 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 = 0u16

Source§

const ONE: Self = 1u16

Source§

const TWO: Self = 2u16

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 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 = 0u32

Source§

const ONE: Self = 1u32

Source§

const TWO: Self = 2u32

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 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 = 0u64

Source§

const ONE: Self = 1u64

Source§

const TWO: Self = 2u64

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 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 = 0u128

Source§

const ONE: Self = 1u128

Source§

const TWO: Self = 2u128

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 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 = 0usize

Source§

const ONE: Self = 1usize

Source§

const TWO: Self = 2usize

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 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§