hacspec_lib::prelude

Trait Numeric

Source
pub trait Numeric:
    ModNumeric
    + Add<Self, Output = Self>
    + Sub<Self, Output = Self>
    + Mul<Self, Output = Self>
    + BitXor<Self, Output = Self>
    + BitOr<Self, Output = Self>
    + BitAnd<Self, Output = Self>
    + Shl<usize, Output = Self>
    + Shr<usize, Output = Self>
    + Not<Output = Self>
    + Default
    + Clone
    + Debug {
Show 20 methods // Required methods fn max_val() -> Self; fn wrap_add(self, rhs: Self) -> Self; fn wrap_sub(self, rhs: Self) -> Self; fn wrap_mul(self, rhs: Self) -> Self; fn wrap_div(self, rhs: Self) -> Self; fn exp(self, exp: u32) -> Self; fn pow_self(self, exp: Self) -> Self; fn divide(self, rhs: Self) -> Self; fn inv(self, n: Self) -> Self; fn equal(self, other: Self) -> bool; fn greater_than(self, other: Self) -> bool; fn greater_than_or_equal(self, other: Self) -> bool; fn less_than(self, other: Self) -> bool; fn less_than_or_equal(self, other: Self) -> bool; fn not_equal_bm(self, other: Self) -> Self; fn equal_bm(self, other: Self) -> Self; fn greater_than_bm(self, other: Self) -> Self; fn greater_than_or_equal_bm(self, other: Self) -> Self; fn less_than_bm(self, other: Self) -> Self; fn less_than_or_equal_bm(self, other: Self) -> Self;
}
Expand description

The Numeric trait has to be implemented by all numeric objects.

Required Methods§

Source

fn max_val() -> Self

Return largest value that can be represented.

Source

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

Source

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

Source

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

Source

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

Source

fn exp(self, exp: u32) -> Self

self ^ exp where exp is a u32.

Source

fn pow_self(self, exp: Self) -> Self

self ^ exp where exp is a Self.

Source

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

Division.

Source

fn inv(self, n: Self) -> Self

Invert self modulo n.

Source

fn equal(self, other: Self) -> bool

Source

fn greater_than(self, other: Self) -> bool

Source

fn greater_than_or_equal(self, other: Self) -> bool

Source

fn less_than(self, other: Self) -> bool

Source

fn less_than_or_equal(self, other: Self) -> bool

Source

fn not_equal_bm(self, other: Self) -> Self

Source

fn equal_bm(self, other: Self) -> Self

Source

fn greater_than_bm(self, other: Self) -> Self

Source

fn greater_than_or_equal_bm(self, other: Self) -> Self

Source

fn less_than_bm(self, other: Self) -> Self

Source

fn less_than_or_equal_bm(self, other: 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 Numeric for i8

Source§

fn max_val() -> Self

Return largest value that can be represented.

Source§

fn exp(self, exp: u32) -> Self

self ^ exp where exp is a u32.

Source§

fn pow_self(self, _exp: Self) -> Self

self ^ exp where exp is a Self. XXX: Not implemented for public machine integers

Source§

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

Division.

Source§

fn inv(self, n: Self) -> Self

Invert self modulo n.

Source§

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

Source§

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

Source§

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

Source§

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

Source§

fn equal(self, other: Self) -> bool

Source§

fn greater_than(self, other: Self) -> bool

Source§

fn greater_than_or_equal(self, other: Self) -> bool

Source§

fn less_than(self, other: Self) -> bool

Source§

fn less_than_or_equal(self, other: Self) -> bool

Source§

fn not_equal_bm(self, other: Self) -> Self

Source§

fn equal_bm(self, other: Self) -> Self

Source§

fn greater_than_bm(self, other: Self) -> Self

Source§

fn greater_than_or_equal_bm(self, other: Self) -> Self

Source§

fn less_than_bm(self, other: Self) -> Self

Source§

fn less_than_or_equal_bm(self, other: Self) -> Self

Source§

impl Numeric for i16

Source§

fn max_val() -> Self

Return largest value that can be represented.

Source§

fn exp(self, exp: u32) -> Self

self ^ exp where exp is a u32.

Source§

fn pow_self(self, _exp: Self) -> Self

self ^ exp where exp is a Self. XXX: Not implemented for public machine integers

Source§

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

Division.

Source§

fn inv(self, n: Self) -> Self

Invert self modulo n.

Source§

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

Source§

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

Source§

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

Source§

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

Source§

fn equal(self, other: Self) -> bool

Source§

fn greater_than(self, other: Self) -> bool

Source§

fn greater_than_or_equal(self, other: Self) -> bool

Source§

fn less_than(self, other: Self) -> bool

Source§

fn less_than_or_equal(self, other: Self) -> bool

Source§

fn not_equal_bm(self, other: Self) -> Self

Source§

fn equal_bm(self, other: Self) -> Self

Source§

fn greater_than_bm(self, other: Self) -> Self

Source§

fn greater_than_or_equal_bm(self, other: Self) -> Self

Source§

fn less_than_bm(self, other: Self) -> Self

Source§

fn less_than_or_equal_bm(self, other: Self) -> Self

Source§

impl Numeric for i32

Source§

fn max_val() -> Self

Return largest value that can be represented.

Source§

fn exp(self, exp: u32) -> Self

self ^ exp where exp is a u32.

Source§

fn pow_self(self, _exp: Self) -> Self

self ^ exp where exp is a Self. XXX: Not implemented for public machine integers

Source§

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

Division.

Source§

fn inv(self, n: Self) -> Self

Invert self modulo n.

Source§

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

Source§

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

Source§

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

Source§

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

Source§

fn equal(self, other: Self) -> bool

Source§

fn greater_than(self, other: Self) -> bool

Source§

fn greater_than_or_equal(self, other: Self) -> bool

Source§

fn less_than(self, other: Self) -> bool

Source§

fn less_than_or_equal(self, other: Self) -> bool

Source§

fn not_equal_bm(self, other: Self) -> Self

Source§

fn equal_bm(self, other: Self) -> Self

Source§

fn greater_than_bm(self, other: Self) -> Self

Source§

fn greater_than_or_equal_bm(self, other: Self) -> Self

Source§

fn less_than_bm(self, other: Self) -> Self

Source§

fn less_than_or_equal_bm(self, other: Self) -> Self

Source§

impl Numeric for i64

Source§

fn max_val() -> Self

Return largest value that can be represented.

Source§

fn exp(self, exp: u32) -> Self

self ^ exp where exp is a u32.

Source§

fn pow_self(self, _exp: Self) -> Self

self ^ exp where exp is a Self. XXX: Not implemented for public machine integers

Source§

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

Division.

Source§

fn inv(self, n: Self) -> Self

Invert self modulo n.

Source§

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

Source§

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

Source§

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

Source§

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

Source§

fn equal(self, other: Self) -> bool

Source§

fn greater_than(self, other: Self) -> bool

Source§

fn greater_than_or_equal(self, other: Self) -> bool

Source§

fn less_than(self, other: Self) -> bool

Source§

fn less_than_or_equal(self, other: Self) -> bool

Source§

fn not_equal_bm(self, other: Self) -> Self

Source§

fn equal_bm(self, other: Self) -> Self

Source§

fn greater_than_bm(self, other: Self) -> Self

Source§

fn greater_than_or_equal_bm(self, other: Self) -> Self

Source§

fn less_than_bm(self, other: Self) -> Self

Source§

fn less_than_or_equal_bm(self, other: Self) -> Self

Source§

impl Numeric for i128

Source§

fn max_val() -> Self

Return largest value that can be represented.

Source§

fn exp(self, exp: u32) -> Self

self ^ exp where exp is a u32.

Source§

fn pow_self(self, _exp: Self) -> Self

self ^ exp where exp is a Self. XXX: Not implemented for public machine integers

Source§

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

Division.

Source§

fn inv(self, n: Self) -> Self

Invert self modulo n.

Source§

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

Source§

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

Source§

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

Source§

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

Source§

fn equal(self, other: Self) -> bool

Source§

fn greater_than(self, other: Self) -> bool

Source§

fn greater_than_or_equal(self, other: Self) -> bool

Source§

fn less_than(self, other: Self) -> bool

Source§

fn less_than_or_equal(self, other: Self) -> bool

Source§

fn not_equal_bm(self, other: Self) -> Self

Source§

fn equal_bm(self, other: Self) -> Self

Source§

fn greater_than_bm(self, other: Self) -> Self

Source§

fn greater_than_or_equal_bm(self, other: Self) -> Self

Source§

fn less_than_bm(self, other: Self) -> Self

Source§

fn less_than_or_equal_bm(self, other: Self) -> Self

Source§

impl Numeric for u8

Source§

fn max_val() -> Self

Return largest value that can be represented.

Source§

fn exp(self, exp: u32) -> Self

self ^ exp where exp is a u32.

Source§

fn pow_self(self, _exp: Self) -> Self

self ^ exp where exp is a Self. XXX: Not implemented for public machine integers

Source§

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

Division.

Source§

fn inv(self, n: Self) -> Self

Invert self modulo n.

Source§

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

Source§

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

Source§

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

Source§

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

Source§

fn equal(self, other: Self) -> bool

Source§

fn greater_than(self, other: Self) -> bool

Source§

fn greater_than_or_equal(self, other: Self) -> bool

Source§

fn less_than(self, other: Self) -> bool

Source§

fn less_than_or_equal(self, other: Self) -> bool

Source§

fn not_equal_bm(self, other: Self) -> Self

Source§

fn equal_bm(self, other: Self) -> Self

Source§

fn greater_than_bm(self, other: Self) -> Self

Source§

fn greater_than_or_equal_bm(self, other: Self) -> Self

Source§

fn less_than_bm(self, other: Self) -> Self

Source§

fn less_than_or_equal_bm(self, other: Self) -> Self

Source§

impl Numeric for u16

Source§

fn max_val() -> Self

Return largest value that can be represented.

Source§

fn exp(self, exp: u32) -> Self

self ^ exp where exp is a u32.

Source§

fn pow_self(self, _exp: Self) -> Self

self ^ exp where exp is a Self. XXX: Not implemented for public machine integers

Source§

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

Division.

Source§

fn inv(self, n: Self) -> Self

Invert self modulo n.

Source§

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

Source§

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

Source§

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

Source§

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

Source§

fn equal(self, other: Self) -> bool

Source§

fn greater_than(self, other: Self) -> bool

Source§

fn greater_than_or_equal(self, other: Self) -> bool

Source§

fn less_than(self, other: Self) -> bool

Source§

fn less_than_or_equal(self, other: Self) -> bool

Source§

fn not_equal_bm(self, other: Self) -> Self

Source§

fn equal_bm(self, other: Self) -> Self

Source§

fn greater_than_bm(self, other: Self) -> Self

Source§

fn greater_than_or_equal_bm(self, other: Self) -> Self

Source§

fn less_than_bm(self, other: Self) -> Self

Source§

fn less_than_or_equal_bm(self, other: Self) -> Self

Source§

impl Numeric for u32

Source§

fn max_val() -> Self

Return largest value that can be represented.

Source§

fn exp(self, exp: u32) -> Self

self ^ exp where exp is a u32.

Source§

fn pow_self(self, _exp: Self) -> Self

self ^ exp where exp is a Self. XXX: Not implemented for public machine integers

Source§

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

Division.

Source§

fn inv(self, n: Self) -> Self

Invert self modulo n.

Source§

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

Source§

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

Source§

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

Source§

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

Source§

fn equal(self, other: Self) -> bool

Source§

fn greater_than(self, other: Self) -> bool

Source§

fn greater_than_or_equal(self, other: Self) -> bool

Source§

fn less_than(self, other: Self) -> bool

Source§

fn less_than_or_equal(self, other: Self) -> bool

Source§

fn not_equal_bm(self, other: Self) -> Self

Source§

fn equal_bm(self, other: Self) -> Self

Source§

fn greater_than_bm(self, other: Self) -> Self

Source§

fn greater_than_or_equal_bm(self, other: Self) -> Self

Source§

fn less_than_bm(self, other: Self) -> Self

Source§

fn less_than_or_equal_bm(self, other: Self) -> Self

Source§

impl Numeric for u64

Source§

fn max_val() -> Self

Return largest value that can be represented.

Source§

fn exp(self, exp: u32) -> Self

self ^ exp where exp is a u32.

Source§

fn pow_self(self, _exp: Self) -> Self

self ^ exp where exp is a Self. XXX: Not implemented for public machine integers

Source§

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

Division.

Source§

fn inv(self, n: Self) -> Self

Invert self modulo n.

Source§

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

Source§

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

Source§

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

Source§

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

Source§

fn equal(self, other: Self) -> bool

Source§

fn greater_than(self, other: Self) -> bool

Source§

fn greater_than_or_equal(self, other: Self) -> bool

Source§

fn less_than(self, other: Self) -> bool

Source§

fn less_than_or_equal(self, other: Self) -> bool

Source§

fn not_equal_bm(self, other: Self) -> Self

Source§

fn equal_bm(self, other: Self) -> Self

Source§

fn greater_than_bm(self, other: Self) -> Self

Source§

fn greater_than_or_equal_bm(self, other: Self) -> Self

Source§

fn less_than_bm(self, other: Self) -> Self

Source§

fn less_than_or_equal_bm(self, other: Self) -> Self

Source§

impl Numeric for u128

Source§

fn max_val() -> Self

Return largest value that can be represented.

Source§

fn exp(self, exp: u32) -> Self

self ^ exp where exp is a u32.

Source§

fn pow_self(self, _exp: Self) -> Self

self ^ exp where exp is a Self. XXX: Not implemented for public machine integers

Source§

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

Division.

Source§

fn inv(self, n: Self) -> Self

Invert self modulo n.

Source§

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

Source§

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

Source§

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

Source§

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

Source§

fn equal(self, other: Self) -> bool

Source§

fn greater_than(self, other: Self) -> bool

Source§

fn greater_than_or_equal(self, other: Self) -> bool

Source§

fn less_than(self, other: Self) -> bool

Source§

fn less_than_or_equal(self, other: Self) -> bool

Source§

fn not_equal_bm(self, other: Self) -> Self

Source§

fn equal_bm(self, other: Self) -> Self

Source§

fn greater_than_bm(self, other: Self) -> Self

Source§

fn greater_than_or_equal_bm(self, other: Self) -> Self

Source§

fn less_than_bm(self, other: Self) -> Self

Source§

fn less_than_or_equal_bm(self, other: Self) -> Self

Implementors§