pub trait PrimitiveInteger:
PrimitiveNumber
+ Eq
+ Ord
+ TryFrom<i8, Error: PrimitiveError>
+ TryFrom<i16, Error: PrimitiveError>
+ TryFrom<i32, Error: PrimitiveError>
+ TryFrom<i64, Error: PrimitiveError>
+ TryFrom<i128, Error: PrimitiveError>
+ TryFrom<isize, Error: PrimitiveError>
+ TryFrom<u8, Error: PrimitiveError>
+ TryFrom<u16, Error: PrimitiveError>
+ TryFrom<u32, Error: PrimitiveError>
+ TryFrom<u64, Error: PrimitiveError>
+ TryFrom<u128, Error: PrimitiveError>
+ TryFrom<usize, Error: PrimitiveError>
+ TryInto<i8, Error: PrimitiveError>
+ TryInto<i16, Error: PrimitiveError>
+ TryInto<i32, Error: PrimitiveError>
+ TryInto<i64, Error: PrimitiveError>
+ TryInto<i128, Error: PrimitiveError>
+ TryInto<isize, Error: PrimitiveError>
+ TryInto<u8, Error: PrimitiveError>
+ TryInto<u16, Error: PrimitiveError>
+ TryInto<u32, Error: PrimitiveError>
+ TryInto<u64, Error: PrimitiveError>
+ TryInto<u128, Error: PrimitiveError>
+ TryInto<usize, Error: PrimitiveError>
+ Binary
+ LowerHex
+ Octal
+ UpperHex
+ Hash
+ BitAnd<Self, Output = Self>
+ BitAndAssign<Self>
+ BitOr<Self, Output = Self>
+ BitOrAssign<Self>
+ BitXor<Self, Output = Self>
+ BitXorAssign<Self>
+ Not<Output = Self>
+ Shl<Self, Output = Self>
+ Shl<i8, Output = Self>
+ Shl<i16, Output = Self>
+ Shl<i32, Output = Self>
+ Shl<i64, Output = Self>
+ Shl<i128, Output = Self>
+ Shl<isize, Output = Self>
+ Shl<u8, Output = Self>
+ Shl<u16, Output = Self>
+ Shl<u32, Output = Self>
+ Shl<u64, Output = Self>
+ Shl<u128, Output = Self>
+ Shl<usize, Output = Self>
+ ShlAssign<Self>
+ ShlAssign<i8>
+ ShlAssign<i16>
+ ShlAssign<i32>
+ ShlAssign<i64>
+ ShlAssign<i128>
+ ShlAssign<isize>
+ ShlAssign<u8>
+ ShlAssign<u16>
+ ShlAssign<u32>
+ ShlAssign<u64>
+ ShlAssign<u128>
+ ShlAssign<usize>
+ Shr<Self, Output = Self>
+ Shr<i8, Output = Self>
+ Shr<i16, Output = Self>
+ Shr<i32, Output = Self>
+ Shr<i64, Output = Self>
+ Shr<i128, Output = Self>
+ Shr<isize, Output = Self>
+ Shr<u8, Output = Self>
+ Shr<u16, Output = Self>
+ Shr<u32, Output = Self>
+ Shr<u64, Output = Self>
+ Shr<u128, Output = Self>
+ Shr<usize, Output = Self>
+ ShrAssign<Self>
+ ShrAssign<i8>
+ ShrAssign<i16>
+ ShrAssign<i32>
+ ShrAssign<i64>
+ ShrAssign<i128>
+ ShrAssign<isize>
+ ShrAssign<u8>
+ ShrAssign<u16>
+ ShrAssign<u32>
+ ShrAssign<u64>
+ ShrAssign<u128>
+ ShrAssign<usize>
+ for<'a> BitAnd<&'a Self, Output = Self>
+ for<'a> BitAndAssign<&'a Self>
+ for<'a> BitOr<&'a Self, Output = Self>
+ for<'a> BitOrAssign<&'a Self>
+ for<'a> BitXor<&'a Self, Output = Self>
+ for<'a> BitXorAssign<&'a Self>
+ for<'a> Shl<&'a Self, Output = Self>
+ for<'a> Shl<&'a i8, Output = Self>
+ for<'a> Shl<&'a i16, Output = Self>
+ for<'a> Shl<&'a i32, Output = Self>
+ for<'a> Shl<&'a i64, Output = Self>
+ for<'a> Shl<&'a i128, Output = Self>
+ for<'a> Shl<&'a isize, Output = Self>
+ for<'a> Shl<&'a u8, Output = Self>
+ for<'a> Shl<&'a u16, Output = Self>
+ for<'a> Shl<&'a u32, Output = Self>
+ for<'a> Shl<&'a u64, Output = Self>
+ for<'a> Shl<&'a u128, Output = Self>
+ for<'a> Shl<&'a usize, Output = Self>
+ for<'a> ShlAssign<&'a Self>
+ for<'a> ShlAssign<&'a i8>
+ for<'a> ShlAssign<&'a i16>
+ for<'a> ShlAssign<&'a i32>
+ for<'a> ShlAssign<&'a i64>
+ for<'a> ShlAssign<&'a i128>
+ for<'a> ShlAssign<&'a isize>
+ for<'a> ShlAssign<&'a u8>
+ for<'a> ShlAssign<&'a u16>
+ for<'a> ShlAssign<&'a u32>
+ for<'a> ShlAssign<&'a u64>
+ for<'a> ShlAssign<&'a u128>
+ for<'a> ShlAssign<&'a usize>
+ for<'a> Shr<&'a Self, Output = Self>
+ for<'a> Shr<&'a i8, Output = Self>
+ for<'a> Shr<&'a i16, Output = Self>
+ for<'a> Shr<&'a i32, Output = Self>
+ for<'a> Shr<&'a i64, Output = Self>
+ for<'a> Shr<&'a i128, Output = Self>
+ for<'a> Shr<&'a isize, Output = Self>
+ for<'a> Shr<&'a u8, Output = Self>
+ for<'a> Shr<&'a u16, Output = Self>
+ for<'a> Shr<&'a u32, Output = Self>
+ for<'a> Shr<&'a u64, Output = Self>
+ for<'a> Shr<&'a u128, Output = Self>
+ for<'a> Shr<&'a usize, Output = Self>
+ for<'a> ShrAssign<&'a Self>
+ for<'a> ShrAssign<&'a i8>
+ for<'a> ShrAssign<&'a i16>
+ for<'a> ShrAssign<&'a i32>
+ for<'a> ShrAssign<&'a i64>
+ for<'a> ShrAssign<&'a i128>
+ for<'a> ShrAssign<&'a isize>
+ for<'a> ShrAssign<&'a u8>
+ for<'a> ShrAssign<&'a u16>
+ for<'a> ShrAssign<&'a u32>
+ for<'a> ShrAssign<&'a u64>
+ for<'a> ShrAssign<&'a u128>
+ for<'a> ShrAssign<&'a usize> {
const BITS: u32;
const MAX: Self;
const MIN: Self;
Show 65 methods
// Required methods
fn checked_add(self, rhs: Self) -> Option<Self>;
fn checked_div(self, rhs: Self) -> Option<Self>;
fn checked_div_euclid(self, rhs: Self) -> Option<Self>;
fn checked_ilog(self, base: Self) -> Option<u32>;
fn checked_ilog10(self) -> Option<u32>;
fn checked_ilog2(self) -> Option<u32>;
fn checked_mul(self, rhs: Self) -> Option<Self>;
fn checked_neg(self) -> Option<Self>;
fn checked_pow(self, exp: u32) -> Option<Self>;
fn checked_rem(self, rhs: Self) -> Option<Self>;
fn checked_rem_euclid(self, rhs: Self) -> Option<Self>;
fn checked_shl(self, rhs: u32) -> Option<Self>;
fn checked_shr(self, rhs: u32) -> Option<Self>;
fn checked_sub(self, rhs: Self) -> Option<Self>;
fn count_ones(self) -> u32;
fn count_zeros(self) -> u32;
fn div_euclid(self, rhs: Self) -> Self;
fn from_be(value: Self) -> Self;
fn from_le(value: Self) -> Self;
fn ilog(self, base: Self) -> u32;
fn ilog10(self) -> u32;
fn ilog2(self) -> u32;
fn isqrt(self) -> Self;
fn leading_ones(self) -> u32;
fn leading_zeros(self) -> u32;
fn overflowing_add(self, rhs: Self) -> (Self, bool);
fn overflowing_div(self, rhs: Self) -> (Self, bool);
fn overflowing_div_euclid(self, rhs: Self) -> (Self, bool);
fn overflowing_mul(self, rhs: Self) -> (Self, bool);
fn overflowing_neg(self) -> (Self, bool);
fn overflowing_pow(self, exp: u32) -> (Self, bool);
fn overflowing_rem(self, rhs: Self) -> (Self, bool);
fn overflowing_rem_euclid(self, rhs: Self) -> (Self, bool);
fn overflowing_shl(self, rhs: u32) -> (Self, bool);
fn overflowing_shr(self, rhs: u32) -> (Self, bool);
fn overflowing_sub(self, rhs: Self) -> (Self, bool);
fn pow(self, exp: u32) -> Self;
fn rem_euclid(self, rhs: Self) -> Self;
fn reverse_bits(self) -> Self;
fn rotate_left(self, n: u32) -> Self;
fn rotate_right(self, n: u32) -> Self;
fn saturating_add(self, rhs: Self) -> Self;
fn saturating_div(self, rhs: Self) -> Self;
fn saturating_mul(self, rhs: Self) -> Self;
fn saturating_pow(self, exp: u32) -> Self;
fn saturating_sub(self, rhs: Self) -> Self;
fn swap_bytes(self) -> Self;
fn to_be(self) -> Self;
fn to_le(self) -> Self;
fn trailing_ones(self) -> u32;
fn trailing_zeros(self) -> u32;
fn wrapping_add(self, rhs: Self) -> Self;
fn wrapping_div(self, rhs: Self) -> Self;
fn wrapping_div_euclid(self, rhs: Self) -> Self;
fn wrapping_mul(self, rhs: Self) -> Self;
fn wrapping_neg(self) -> Self;
fn wrapping_pow(self, exp: u32) -> Self;
fn wrapping_rem(self, rhs: Self) -> Self;
fn wrapping_rem_euclid(self, rhs: Self) -> Self;
fn wrapping_shl(self, rhs: u32) -> Self;
fn wrapping_shr(self, rhs: u32) -> Self;
fn wrapping_sub(self, rhs: Self) -> Self;
unsafe fn unchecked_add(self, rhs: Self) -> Self;
unsafe fn unchecked_mul(self, rhs: Self) -> Self;
unsafe fn unchecked_sub(self, rhs: Self) -> Self;
}Expand description
Trait for all primitive integer types, including the supertrait PrimitiveNumber.
This encapsulates trait implementations, constants, and inherent methods that are common among
all of the primitive integer types: i8, i16, i32, i64, i128, isize,
u8, u16, u32, u64, u128, and usize.
See the corresponding items on the individual types for more documentation and examples.
This trait is sealed with a private trait to prevent downstream implementations, so we may continue to expand along with the standard library without worrying about breaking changes for implementors.
§Examples
use num_primitive::PrimitiveInteger;
fn div_rem<T: PrimitiveInteger>(a: T, b: T) -> (T, T) {
(a / b, a % b)
}
fn div_rem_euclid<T: PrimitiveInteger>(a: T, b: T) -> (T, T) {
(a.div_euclid(b), a.rem_euclid(b))
}
assert_eq!(div_rem::<u8>(48, 18), (2, 12));
assert_eq!(div_rem::<i8>(-48, 18), (-2, -12));
assert_eq!(div_rem_euclid::<u8>(48, 18), (2, 12));
assert_eq!(div_rem_euclid::<i8>(-48, 18), (-3, 6));Required Associated Constants§
Required Methods§
Sourcefn checked_add(self, rhs: Self) -> Option<Self>
fn checked_add(self, rhs: Self) -> Option<Self>
Checked integer addition. Computes self + rhs, returning None if overflow occurred.
Sourcefn checked_div(self, rhs: Self) -> Option<Self>
fn checked_div(self, rhs: Self) -> Option<Self>
Checked integer division. Computes self / rhs, returning None if rhs == 0 or the
division results in overflow.
Sourcefn checked_div_euclid(self, rhs: Self) -> Option<Self>
fn checked_div_euclid(self, rhs: Self) -> Option<Self>
Checked Euclidean division. Computes self.div_euclid(rhs), returning None if rhs == 0
or the division results in overflow.
Sourcefn checked_ilog(self, base: Self) -> Option<u32>
fn checked_ilog(self, base: Self) -> Option<u32>
Returns the logarithm of the number with respect to an arbitrary base, rounded down.
Returns None if the number is negative or zero, or if the base is not at least 2.
Sourcefn checked_ilog10(self) -> Option<u32>
fn checked_ilog10(self) -> Option<u32>
Returns the base 10 logarithm of the number, rounded down. Returns None if the number is
negative or zero.
Sourcefn checked_ilog2(self) -> Option<u32>
fn checked_ilog2(self) -> Option<u32>
Returns the base 2 logarithm of the number, rounded down. Returns None if the number is
negative or zero.
Sourcefn checked_mul(self, rhs: Self) -> Option<Self>
fn checked_mul(self, rhs: Self) -> Option<Self>
Checked integer multiplication. Computes self * rhs, returning None if overflow
occurred.
Sourcefn checked_neg(self) -> Option<Self>
fn checked_neg(self) -> Option<Self>
Checked negation. Computes -self, returning None if self == MIN.
Sourcefn checked_pow(self, exp: u32) -> Option<Self>
fn checked_pow(self, exp: u32) -> Option<Self>
Checked exponentiation. Computes self.pow(exp), returning None if overflow occurred.
Sourcefn checked_rem(self, rhs: Self) -> Option<Self>
fn checked_rem(self, rhs: Self) -> Option<Self>
Checked integer remainder. Computes self % rhs, returning None if rhs == 0 or the
division results in overflow.
Sourcefn checked_rem_euclid(self, rhs: Self) -> Option<Self>
fn checked_rem_euclid(self, rhs: Self) -> Option<Self>
Checked Euclidean remainder. Computes self.rem_euclid(rhs), returning None if rhs == 0 or the division results in overflow.
Sourcefn checked_shl(self, rhs: u32) -> Option<Self>
fn checked_shl(self, rhs: u32) -> Option<Self>
Checked shift left. Computes self << rhs, returning None if rhs is larger than or
equal to the number of bits in self.
Sourcefn checked_shr(self, rhs: u32) -> Option<Self>
fn checked_shr(self, rhs: u32) -> Option<Self>
Checked shift right. Computes self >> rhs, returning None if rhs is larger than or
equal to the number of bits in self.
Sourcefn checked_sub(self, rhs: Self) -> Option<Self>
fn checked_sub(self, rhs: Self) -> Option<Self>
Checked integer subtraction. Computes self - rhs, returning None if overflow occurred.
Sourcefn count_ones(self) -> u32
fn count_ones(self) -> u32
Returns the number of ones in the binary representation of self.
Sourcefn count_zeros(self) -> u32
fn count_zeros(self) -> u32
Returns the number of zeros in the binary representation of self.
Sourcefn div_euclid(self, rhs: Self) -> Self
fn div_euclid(self, rhs: Self) -> Self
Calculates the quotient of Euclidean division of self by rhs. This computes the integer
q such that self = q * rhs + r, with r = self.rem_euclid(rhs) and 0 <= r < abs(rhs).
Sourcefn from_be(value: Self) -> Self
fn from_be(value: Self) -> Self
Converts an integer from big endian to the target’s endianness.
Sourcefn from_le(value: Self) -> Self
fn from_le(value: Self) -> Self
Converts an integer from little endian to the target’s endianness.
Sourcefn ilog(self, base: Self) -> u32
fn ilog(self, base: Self) -> u32
Returns the logarithm of the number with respect to an arbitrary base, rounded down.
Sourcefn leading_ones(self) -> u32
fn leading_ones(self) -> u32
Returns the number of leading ones in the binary representation of self.
Sourcefn leading_zeros(self) -> u32
fn leading_zeros(self) -> u32
Returns the number of leading zeros in the binary representation of self.
Sourcefn overflowing_add(self, rhs: Self) -> (Self, bool)
fn overflowing_add(self, rhs: Self) -> (Self, bool)
Calculates self + rhs. Returns a tuple of the addition along with a boolean indicating
whether an arithmetic overflow would occur.
Sourcefn overflowing_div(self, rhs: Self) -> (Self, bool)
fn overflowing_div(self, rhs: Self) -> (Self, bool)
Calculates the divisor when self is divided by rhs. Returns a tuple of the divisor
along with a boolean indicating whether an arithmetic overflow would occur.
Sourcefn overflowing_div_euclid(self, rhs: Self) -> (Self, bool)
fn overflowing_div_euclid(self, rhs: Self) -> (Self, bool)
Calculates the quotient of Euclidean division self.div_euclid(rhs). Returns a tuple of
the divisor along with a boolean indicating whether an arithmetic overflow would occur.
Sourcefn overflowing_mul(self, rhs: Self) -> (Self, bool)
fn overflowing_mul(self, rhs: Self) -> (Self, bool)
Calculates the multiplication of self and rhs. Returns a tuple of the multiplication
along with a boolean indicating whether an arithmetic overflow would occur.
Sourcefn overflowing_neg(self) -> (Self, bool)
fn overflowing_neg(self) -> (Self, bool)
Negates self, overflowing if this is equal to the minimum value. Returns a tuple of the
negated version of self along with a boolean indicating whether an overflow happened.
Sourcefn overflowing_pow(self, exp: u32) -> (Self, bool)
fn overflowing_pow(self, exp: u32) -> (Self, bool)
Raises self to the power of exp, using exponentiation by squaring. Returns a tuple of
the exponentiation along with a bool indicating whether an overflow happened.
Sourcefn overflowing_rem(self, rhs: Self) -> (Self, bool)
fn overflowing_rem(self, rhs: Self) -> (Self, bool)
Calculates the remainder when self is divided by rhs. Returns a tuple of the remainder
after dividing along with a boolean indicating whether an arithmetic overflow would occur.
Sourcefn overflowing_rem_euclid(self, rhs: Self) -> (Self, bool)
fn overflowing_rem_euclid(self, rhs: Self) -> (Self, bool)
Overflowing Euclidean remainder. Calculates self.rem_euclid(rhs). Returns a tuple of the
remainder after dividing along with a boolean indicating whether an arithmetic overflow
would occur.
Sourcefn overflowing_shl(self, rhs: u32) -> (Self, bool)
fn overflowing_shl(self, rhs: u32) -> (Self, bool)
Shifts self left by rhs bits. Returns a tuple of the shifted version of self along
with a boolean indicating whether the shift value was larger than or equal to the number of
bits.
Sourcefn overflowing_shr(self, rhs: u32) -> (Self, bool)
fn overflowing_shr(self, rhs: u32) -> (Self, bool)
Shifts self right by rhs bits. Returns a tuple of the shifted version of self along
with a boolean indicating whether the shift value was larger than or equal to the number of
bits.
Sourcefn overflowing_sub(self, rhs: Self) -> (Self, bool)
fn overflowing_sub(self, rhs: Self) -> (Self, bool)
Calculates self - rhs. Returns a tuple of the subtraction along with a boolean indicating
whether an arithmetic overflow would occur.
Sourcefn pow(self, exp: u32) -> Self
fn pow(self, exp: u32) -> Self
Raises self to the power of exp, using exponentiation by squaring.
Sourcefn rem_euclid(self, rhs: Self) -> Self
fn rem_euclid(self, rhs: Self) -> Self
Calculates the least nonnegative remainder of self (mod rhs). This is done as if by the
Euclidean division algorithm – given r = self.rem_euclid(rhs), the result satisfies self = rhs * self.div_euclid(rhs) + r and 0 <= r < abs(rhs).
Sourcefn reverse_bits(self) -> Self
fn reverse_bits(self) -> Self
Reverses the order of bits in the integer.
Sourcefn rotate_left(self, n: u32) -> Self
fn rotate_left(self, n: u32) -> Self
Shifts the bits to the left by a specified amount, n, wrapping the truncated bits to the end of the resulting integer.
Sourcefn rotate_right(self, n: u32) -> Self
fn rotate_right(self, n: u32) -> Self
Shifts the bits to the right by a specified amount, n, wrapping the truncated bits to the beginning of the resulting integer.
Sourcefn saturating_add(self, rhs: Self) -> Self
fn saturating_add(self, rhs: Self) -> Self
Saturating integer addition. Computes self + rhs, saturating at the numeric bounds
instead of overflowing.
Sourcefn saturating_div(self, rhs: Self) -> Self
fn saturating_div(self, rhs: Self) -> Self
Saturating integer division. Computes self / rhs, saturating at the numeric bounds
instead of overflowing.
Sourcefn saturating_mul(self, rhs: Self) -> Self
fn saturating_mul(self, rhs: Self) -> Self
Saturating integer multiplication. Computes self * rhs, saturating at the numeric bounds
instead of overflowing.
Sourcefn saturating_pow(self, exp: u32) -> Self
fn saturating_pow(self, exp: u32) -> Self
Saturating integer exponentiation. Computes self.pow(exp), saturating at the numeric
bounds instead of overflowing.
Sourcefn saturating_sub(self, rhs: Self) -> Self
fn saturating_sub(self, rhs: Self) -> Self
Saturating integer subtraction. Computes self - rhs, saturating at the numeric bounds
instead of overflowing.
Sourcefn swap_bytes(self) -> Self
fn swap_bytes(self) -> Self
Reverses the byte order of the integer.
Sourcefn trailing_ones(self) -> u32
fn trailing_ones(self) -> u32
Returns the number of trailing ones in the binary representation of self.
Sourcefn trailing_zeros(self) -> u32
fn trailing_zeros(self) -> u32
Returns the number of trailing zeros in the binary representation of self.
Sourcefn wrapping_add(self, rhs: Self) -> Self
fn wrapping_add(self, rhs: Self) -> Self
Wrapping (modular) addition. Computes self + rhs, wrapping around at the boundary of the
type.
Sourcefn wrapping_div(self, rhs: Self) -> Self
fn wrapping_div(self, rhs: Self) -> Self
Wrapping (modular) division. Computes self / rhs, wrapping around at the boundary of the
type.
Sourcefn wrapping_div_euclid(self, rhs: Self) -> Self
fn wrapping_div_euclid(self, rhs: Self) -> Self
Wrapping Euclidean division. Computes self.div_euclid(rhs), wrapping around at the
boundary of the type.
Sourcefn wrapping_mul(self, rhs: Self) -> Self
fn wrapping_mul(self, rhs: Self) -> Self
Wrapping (modular) multiplication. Computes self * rhs, wrapping around at the boundary
of the type.
Sourcefn wrapping_neg(self) -> Self
fn wrapping_neg(self) -> Self
Wrapping (modular) negation. Computes -self, wrapping around at the boundary of the type.
Sourcefn wrapping_pow(self, exp: u32) -> Self
fn wrapping_pow(self, exp: u32) -> Self
Wrapping (modular) exponentiation. Computes self.pow(exp), wrapping around at the
boundary of the type.
Sourcefn wrapping_rem(self, rhs: Self) -> Self
fn wrapping_rem(self, rhs: Self) -> Self
Wrapping (modular) remainder. Computes self % rhs, wrapping around at the boundary of the
type.
Sourcefn wrapping_rem_euclid(self, rhs: Self) -> Self
fn wrapping_rem_euclid(self, rhs: Self) -> Self
Wrapping Euclidean remainder. Computes self.rem_euclid(rhs), wrapping around at the
boundary of the type.
Sourcefn wrapping_shl(self, rhs: u32) -> Self
fn wrapping_shl(self, rhs: u32) -> Self
Panic-free bitwise shift-left; yields self << mask(rhs), where mask removes any
high-order bits of rhs that would cause the shift to exceed the bitwidth of the type.
Sourcefn wrapping_shr(self, rhs: u32) -> Self
fn wrapping_shr(self, rhs: u32) -> Self
Panic-free bitwise shift-right; yields self >> mask(rhs), where mask removes any
high-order bits of rhs that would cause the shift to exceed the bitwidth of the type.
Sourcefn wrapping_sub(self, rhs: Self) -> Self
fn wrapping_sub(self, rhs: Self) -> Self
Wrapping (modular) subtraction. Computes self - rhs, wrapping around at the boundary of
the type.
Sourceunsafe fn unchecked_add(self, rhs: Self) -> Self
unsafe fn unchecked_add(self, rhs: Self) -> Self
Unchecked integer addition. Computes self + rhs, assuming overflow cannot occur.
§Safety
This results in undefined behavior when self + rhs > Self::MAX or self + rhs < Self::MIN, i.e. when checked_add would return None.
Sourceunsafe fn unchecked_mul(self, rhs: Self) -> Self
unsafe fn unchecked_mul(self, rhs: Self) -> Self
Unchecked integer multiplication. Computes self * rhs, assuming overflow cannot occur.
§Safety
This results in undefined behavior when self * rhs > Self::MAX or self * rhs < Self::MIN, i.e. when checked_mul would return None.
Sourceunsafe fn unchecked_sub(self, rhs: Self) -> Self
unsafe fn unchecked_sub(self, rhs: Self) -> Self
Unchecked integer subtraction. Computes self - rhs, assuming overflow cannot occur.
§Safety
This results in undefined behavior when self - rhs > Self::MAX or self - rhs < Self::MIN, i.e. when checked_sub would return None.
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.