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§
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 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
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
impl Numeric for i8
Source§fn pow_self(self, _exp: Self) -> Self
fn pow_self(self, _exp: Self) -> Self
self ^ exp
where exp
is a Self
.
XXX: Not implemented for public machine integers
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 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
Source§impl Numeric for i16
impl Numeric for i16
Source§fn pow_self(self, _exp: Self) -> Self
fn pow_self(self, _exp: Self) -> Self
self ^ exp
where exp
is a Self
.
XXX: Not implemented for public machine integers
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 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
Source§impl Numeric for i32
impl Numeric for i32
Source§fn pow_self(self, _exp: Self) -> Self
fn pow_self(self, _exp: Self) -> Self
self ^ exp
where exp
is a Self
.
XXX: Not implemented for public machine integers
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 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
Source§impl Numeric for i64
impl Numeric for i64
Source§fn pow_self(self, _exp: Self) -> Self
fn pow_self(self, _exp: Self) -> Self
self ^ exp
where exp
is a Self
.
XXX: Not implemented for public machine integers
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 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
Source§impl Numeric for i128
impl Numeric for i128
Source§fn pow_self(self, _exp: Self) -> Self
fn pow_self(self, _exp: Self) -> Self
self ^ exp
where exp
is a Self
.
XXX: Not implemented for public machine integers
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 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
Source§impl Numeric for u8
impl Numeric for u8
Source§fn pow_self(self, _exp: Self) -> Self
fn pow_self(self, _exp: Self) -> Self
self ^ exp
where exp
is a Self
.
XXX: Not implemented for public machine integers
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 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
Source§impl Numeric for u16
impl Numeric for u16
Source§fn pow_self(self, _exp: Self) -> Self
fn pow_self(self, _exp: Self) -> Self
self ^ exp
where exp
is a Self
.
XXX: Not implemented for public machine integers
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 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
Source§impl Numeric for u32
impl Numeric for u32
Source§fn pow_self(self, _exp: Self) -> Self
fn pow_self(self, _exp: Self) -> Self
self ^ exp
where exp
is a Self
.
XXX: Not implemented for public machine integers
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 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
Source§impl Numeric for u64
impl Numeric for u64
Source§fn pow_self(self, _exp: Self) -> Self
fn pow_self(self, _exp: Self) -> Self
self ^ exp
where exp
is a Self
.
XXX: Not implemented for public machine integers
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 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
Source§impl Numeric for u128
impl Numeric for u128
Source§fn pow_self(self, _exp: Self) -> Self
fn pow_self(self, _exp: Self) -> Self
self ^ exp
where exp
is a Self
.
XXX: Not implemented for public machine integers