pub trait Unsigned:
Sized
+ Copy
+ Shr<u32, Output = Self>
+ Shl<u32, Output = Self>
+ BitXor<Self, Output = Self>
+ BitAnd<Self, Output = Self>
+ PartialOrd<Self>
+ Ord {
type Signed: Signed;
const ONE: Self;
const BYTES: u8;
// Required methods
fn signed(self) -> Self::Signed;
fn from_byte(byte: u8) -> Self;
fn as_byte(self) -> u8;
fn is_smaller_than(self, byte: u8) -> bool;
fn is_zero(self) -> bool;
fn checked_shr(self, value: u32) -> Option<Self>;
fn checked_shl(self, value: u32) -> Option<Self>;
fn checked_add(self, value: Self) -> Option<Self>;
}
Expand description
Trait that encodes common behaviors of unsigned numbers.
Required Associated Constants§
Required Associated Types§
Required Methods§
Sourcefn is_smaller_than(self, byte: u8) -> bool
fn is_smaller_than(self, byte: u8) -> bool
Test if this value is smaller than the specified byte.
Sourcefn checked_shr(self, value: u32) -> Option<Self>
fn checked_shr(self, value: u32) -> Option<Self>
Perform a shift-right operation.
Sourcefn checked_shl(self, value: u32) -> Option<Self>
fn checked_shl(self, value: u32) -> Option<Self>
Perform a shift-left operation.
Sourcefn checked_add(self, value: Self) -> Option<Self>
fn checked_add(self, value: Self) -> Option<Self>
Perform a checked addition.
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.