[][src]Trait bitstream_io::Numeric

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> {
    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; }

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 one() -> Self

The value of 1 in this type

fn is_zero(self) -> bool

Returns true if this value is 0, in its type

fn from_u8(u: u8) -> Self

Returns a u8 value in this type

fn to_u8(self) -> u8

Assuming 0 <= value < 256, returns this value as a u8 type

fn count_ones(self) -> u32

Counts the number of 1 bits

fn leading_zeros(self) -> u32

Counts the number of leading zeros

fn trailing_zeros(self) -> u32

Counts the number of trailing zeros

fn bits_size() -> u32

Size of type in bits

Loading content...

Implementations on Foreign Types

impl Numeric for u8[src]

impl Numeric for i8[src]

impl Numeric for u16[src]

impl Numeric for i16[src]

impl Numeric for u32[src]

impl Numeric for i32[src]

impl Numeric for u64[src]

impl Numeric for i64[src]

impl Numeric for u128[src]

impl Numeric for i128[src]

Loading content...


Loading content...