pub trait Int:
MinInt
+ Display
+ Binary
+ LowerHex
+ PartialEq
+ PartialOrd
+ AddAssign
+ SubAssign
+ MulAssign
+ DivAssign
+ RemAssign
+ BitAndAssign
+ BitOrAssign
+ BitXorAssign
+ ShlAssign<i32>
+ ShlAssign<u32>
+ ShrAssign<u32>
+ ShrAssign<i32>
+ Add<Output = Self>
+ Sub<Output = Self>
+ Mul<Output = Self>
+ Div<Output = Self>
+ Rem<Output = Self>
+ Shl<i32, Output = Self>
+ Shl<u32, Output = Self>
+ Shr<i32, Output = Self>
+ Shr<u32, Output = Self>
+ BitXor<Output = Self>
+ BitAnd<Output = Self>
+ Ord
+ From<bool>
+ CastFrom<i32>
+ CastFrom<u16>
+ CastFrom<u32>
+ CastFrom<u8>
+ CastFrom<usize>
+ CastInto<i32>
+ CastInto<u16>
+ CastInto<u32>
+ CastInto<u8>
+ CastInto<usize> {
Show 21 methods
// Required methods
fn signed(self) -> <Self::Unsigned as MinInt>::OtherSign;
fn unsigned(self) -> Self::Unsigned;
fn from_unsigned(unsigned: Self::Unsigned) -> Self;
fn abs(self) -> Self;
fn from_bool(b: bool) -> Self;
fn logical_shr(self, other: u32) -> Self;
fn abs_diff(self, other: Self) -> Self::Unsigned;
fn is_zero(self) -> bool;
fn checked_add(self, other: Self) -> Option<Self>;
fn checked_sub(self, other: Self) -> Option<Self>;
fn wrapping_neg(self) -> Self;
fn wrapping_add(self, other: Self) -> Self;
fn wrapping_mul(self, other: Self) -> Self;
fn wrapping_sub(self, other: Self) -> Self;
fn wrapping_shl(self, other: u32) -> Self;
fn wrapping_shr(self, other: u32) -> Self;
fn rotate_left(self, other: u32) -> Self;
fn overflowing_add(self, other: Self) -> (Self, bool);
fn overflowing_sub(self, other: Self) -> (Self, bool);
fn leading_zeros(self) -> u32;
fn ilog2(self) -> u32;
}
Expand description
Trait for some basic operations on integers
Required Methods§
fn signed(self) -> <Self::Unsigned as MinInt>::OtherSign
fn unsigned(self) -> Self::Unsigned
fn from_unsigned(unsigned: Self::Unsigned) -> Self
fn abs(self) -> Self
fn from_bool(b: bool) -> Self
Sourcefn logical_shr(self, other: u32) -> Self
fn logical_shr(self, other: u32) -> Self
Prevents the need for excessive conversions between signed and unsigned
fn is_zero(self) -> bool
fn checked_add(self, other: Self) -> Option<Self>
fn checked_sub(self, other: Self) -> Option<Self>
fn wrapping_neg(self) -> Self
fn wrapping_add(self, other: Self) -> Self
fn wrapping_mul(self, other: Self) -> Self
fn wrapping_sub(self, other: Self) -> Self
fn wrapping_shl(self, other: u32) -> Self
fn wrapping_shr(self, other: u32) -> Self
fn rotate_left(self, other: u32) -> Self
fn overflowing_add(self, other: Self) -> (Self, bool)
fn overflowing_sub(self, other: Self) -> (Self, bool)
fn leading_zeros(self) -> u32
fn ilog2(self) -> u32
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.