Trait Num

Source
pub trait Num:
    Default
    + PartialEq
    + PartialOrd
    + Copy
    + AddAssign
    + MulAssign
    + SubAssign
    + DivAssign
    + Add<Output = Self>
    + Mul<Output = Self>
    + Sub<Output = Self>
    + Div<Output = Self>
    + Neg<Output = Self> {
    // Required methods
    fn zero() -> Self;
    fn two() -> Self;
    fn four() -> Self;
    fn max() -> Self;
    fn from_usize(value: usize) -> Self;
    fn get_max(a: Self, b: Self) -> Self;
    fn get_min(a: Self, b: Self) -> Self;
}
Expand description

A signed Number type. Currently implemented for f32, f64, i8, i16, i32 and i64.

Required Methods§

Source

fn zero() -> Self

Source

fn two() -> Self

Source

fn four() -> Self

Source

fn max() -> Self

Source

fn from_usize(value: usize) -> Self

Source

fn get_max(a: Self, b: Self) -> Self

Source

fn get_min(a: Self, b: 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 Num for f32

Source§

impl Num for f64

Source§

impl Num for i8

Source§

fn zero() -> i8

Source§

fn two() -> i8

Source§

fn four() -> i8

Source§

fn max() -> i8

Source§

fn from_usize(value: usize) -> i8

Source§

fn get_max(a: i8, b: i8) -> i8

Source§

fn get_min(a: i8, b: i8) -> i8

Source§

impl Num for i16

Source§

impl Num for i32

Source§

impl Num for i64

Implementors§