Trait utils::number::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;
}
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

Object Safety§

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 MIN: Self = -Inf_f32

source§

const MAX: Self = +Inf_f32

source§

fn abs(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 MIN: Self = -Inf_f64

source§

const MAX: Self = +Inf_f64

source§

fn abs(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 MIN: Self = -128i8

source§

const MAX: Self = 127i8

source§

fn abs(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 MIN: Self = -32_768i16

source§

const MAX: Self = 32_767i16

source§

fn abs(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 MIN: Self = -2_147_483_648i32

source§

const MAX: Self = 2_147_483_647i32

source§

fn abs(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 MIN: Self = -9_223_372_036_854_775_808i64

source§

const MAX: Self = 9_223_372_036_854_775_807i64

source§

fn abs(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 MIN: Self = -170_141_183_460_469_231_731_687_303_715_884_105_728i128

source§

const MAX: Self = 170_141_183_460_469_231_731_687_303_715_884_105_727i128

source§

fn abs(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 MIN: Self = -9_223_372_036_854_775_808isize

source§

const MAX: Self = 9_223_372_036_854_775_807isize

source§

fn abs(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 MIN: Self = 0u8

source§

const MAX: Self = 255u8

source§

fn abs(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 MIN: Self = 0u16

source§

const MAX: Self = 65_535u16

source§

fn abs(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 MIN: Self = 0u32

source§

const MAX: Self = 4_294_967_295u32

source§

fn abs(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 MIN: Self = 0u64

source§

const MAX: Self = 18_446_744_073_709_551_615u64

source§

fn abs(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 MIN: Self = 0u128

source§

const MAX: Self = 340_282_366_920_938_463_463_374_607_431_768_211_455u128

source§

fn abs(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 MIN: Self = 0usize

source§

const MAX: Self = 18_446_744_073_709_551_615usize

source§

fn abs(self) -> Self

source§

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

Implementors§