Trait bitstream_io::Numeric [−][src]
pub trait Numeric: 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> { type Bytes: AsRef<[u8]> + AsMut<[u8]>;}Show methods
fn one() -> Self; 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 bits_size() -> u32; fn buffer() -> Self::Bytes; fn to_be_bytes(self) -> Self::Bytes; fn to_le_bytes(self) -> Self::Bytes; fn from_be_bytes(bytes: Self::Bytes) -> Self; fn from_le_bytes(bytes: Self::Bytes) -> Self; 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.
Associated Types
Required methods
fn count_ones(self) -> u32
[src]
fn count_ones(self) -> u32
[src]Counts the number of 1 bits
fn leading_zeros(self) -> u32
[src]
fn leading_zeros(self) -> u32
[src]Counts the number of leading zeros
fn trailing_zeros(self) -> u32
[src]
fn trailing_zeros(self) -> u32
[src]Counts the number of trailing zeros
fn to_be_bytes(self) -> Self::Bytes
[src]
fn to_be_bytes(self) -> Self::Bytes
[src]Our value in big-endian bytes
fn to_le_bytes(self) -> Self::Bytes
[src]
fn to_le_bytes(self) -> Self::Bytes
[src]Our value in little-endian bytes
fn from_be_bytes(bytes: Self::Bytes) -> Self
[src]
fn from_be_bytes(bytes: Self::Bytes) -> Self
[src]Convert big-endian bytes to our value
fn from_le_bytes(bytes: Self::Bytes) -> Self
[src]
fn from_le_bytes(bytes: Self::Bytes) -> Self
[src]Convert little-endian bytes to out value
fn unsigned_value(self) -> UnsignedValue
[src]
fn unsigned_value(self) -> UnsignedValue
[src]Convert to a generic unsigned write value for stream recording purposes