Trait musli_binary_common::int::Unsigned
source · [−]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;
fn signed(self) -> Self::Signed;
fn from_byte(byte: u8) -> Self;
fn as_byte(self) -> u8;
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 Types
Required Associated Constants
Required Methods
fn checked_shr(self, value: u32) -> Option<Self>
fn checked_shr(self, value: u32) -> Option<Self>
Perform a shift-right operation.
fn checked_shl(self, value: u32) -> Option<Self>
fn checked_shl(self, value: u32) -> Option<Self>
Perform a shift-left operation.
fn checked_add(self, value: Self) -> Option<Self>
fn checked_add(self, value: Self) -> Option<Self>
Perform a checked addition.