Trait lexical_util::num::Integer
source · pub trait Integer:
Number
+ Eq
+ Ord
+ BitAnd<Output = Self>
+ BitAndAssign
+ BitOr<Output = Self>
+ BitOrAssign
+ BitXor<Output = Self>
+ BitXorAssign
+ Not<Output = Self>
+ Shl<Self, Output = Self>
+ Shl<i32, Output = Self>
+ ShlAssign<i32>
+ Shr<i32, Output = Self>
+ ShrAssign<i32> {
const ZERO: Self;
const ONE: Self;
const TWO: Self;
const MAX: Self;
const MIN: Self;
const BITS: usize;
Show 21 methods
// Required methods
fn leading_zeros(self) -> u32;
fn trailing_zeros(self) -> u32;
fn pow(self, exp: u32) -> Self;
fn checked_add(self, i: Self) -> Option<Self>;
fn checked_sub(self, i: Self) -> Option<Self>;
fn checked_mul(self, i: Self) -> Option<Self>;
fn overflowing_add(self, i: Self) -> (Self, bool);
fn overflowing_mul(self, i: Self) -> (Self, bool);
fn wrapping_add(self, i: Self) -> Self;
fn wrapping_sub(self, i: Self) -> Self;
fn wrapping_mul(self, i: Self) -> Self;
fn wrapping_neg(self) -> Self;
fn saturating_add(self, i: Self) -> Self;
fn saturating_sub(self, i: Self) -> Self;
fn saturating_mul(self, i: Self) -> Self;
// Provided methods
fn ceil_divmod(self, y: Self) -> (Self, i32) { ... }
fn ceil_div(self, y: Self) -> Self { ... }
fn ceil_mod(self, y: Self) -> i32 { ... }
fn bit_length(self) -> u32 { ... }
fn is_odd(self) -> bool { ... }
fn is_even(self) -> bool { ... }
}
Expand description
Defines a trait that supports integral operations.
Required Associated Constants§
const ZERO: Self
const ONE: Self
const TWO: Self
const MAX: Self
const MIN: Self
const BITS: usize
Required Methods§
fn leading_zeros(self) -> u32
fn trailing_zeros(self) -> u32
fn pow(self, exp: u32) -> Self
fn checked_add(self, i: Self) -> Option<Self>
fn checked_sub(self, i: Self) -> Option<Self>
fn checked_mul(self, i: Self) -> Option<Self>
fn overflowing_add(self, i: Self) -> (Self, bool)
fn overflowing_mul(self, i: Self) -> (Self, bool)
fn wrapping_add(self, i: Self) -> Self
fn wrapping_sub(self, i: Self) -> Self
fn wrapping_mul(self, i: Self) -> Self
fn wrapping_neg(self) -> Self
fn saturating_add(self, i: Self) -> Self
fn saturating_sub(self, i: Self) -> Self
fn saturating_mul(self, i: Self) -> Self
Provided Methods§
sourcefn ceil_divmod(self, y: Self) -> (Self, i32)
fn ceil_divmod(self, y: Self) -> (Self, i32)
Get the fast ceiling of the quotient from integer division. Not safe, since the remainder can easily overflow.
sourcefn ceil_div(self, y: Self) -> Self
fn ceil_div(self, y: Self) -> Self
Get the fast ceiling of the quotient from integer division. Not safe, since the remainder can easily overflow.
sourcefn ceil_mod(self, y: Self) -> i32
fn ceil_mod(self, y: Self) -> i32
Get the fast ceiling modulus from integer division. Not safe, since the remainder can easily overflow.
sourcefn bit_length(self) -> u32
fn bit_length(self) -> u32
Get the number of bits in a value.
Object Safety§
This trait is not object safe.