Trait bitstream_io::Numeric
source · pub 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> {
const BITS_SIZE: u32;
const ONE: Self;
// Required methods
fn is_zero(self) -> bool;
fn from_u8(u: u8) -> Self;
fn to_u8(self) -> u8;
fn count_ones(self) -> u32;
fn leading_zeros(self) -> u32;
fn trailing_zeros(self) -> u32;
fn unsigned_value(self) -> UnsignedValue;
}Expand description
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 Associated Constants§
Required Methods§
sourcefn count_ones(self) -> u32
fn count_ones(self) -> u32
Counts the number of 1 bits
sourcefn leading_zeros(self) -> u32
fn leading_zeros(self) -> u32
Counts the number of leading zeros
sourcefn trailing_zeros(self) -> u32
fn trailing_zeros(self) -> u32
Counts the number of trailing zeros
sourcefn unsigned_value(self) -> UnsignedValue
fn unsigned_value(self) -> UnsignedValue
Convert to a generic unsigned write value for stream recording purposes
Object Safety§
This trait is not object safe.