Trait Numeric
trait Numeric: Primitive + Sized + Copy + Default + Debug + PartialOrd + Shl<u32, Output = Self> + ShlAssign<u32> + Shr<u32, Output = Self> + ShrAssign<u32> + Rem<Self, Output = Self> + RemAssign<Self> + BitOrAssign<Self> + BitXor<Self, Output = Self> + Not<Output = Self> + Sub<Self, Output = Self>
This trait extends many common integer types (both unsigned and signed) with a few trivial methods so that they can be used with the bitstream handling traits.
Required Methods
fn is_zero(self: Self) -> boolReturns true if this value is 0, in its type
fn from_u8(u: u8) -> SelfReturns a
u8value in this typefn to_u8(self: Self) -> u8Assuming 0 <= value < 256, returns this value as a
u8typefn count_ones(self: Self) -> u32Counts the number of 1 bits
fn leading_zeros(self: Self) -> u32Counts the number of leading zeros
fn trailing_zeros(self: Self) -> u32Counts the number of trailing zeros
fn unsigned_value(self: Self) -> UnsignedValueConvert to a generic unsigned write value for stream recording purposes
Implementors
impl Numeric for u128impl Numeric for u8impl Numeric for i16impl Numeric for u64impl Numeric for i128impl Numeric for i8impl Numeric for u32impl Numeric for i64impl Numeric for u16impl Numeric for i32