Trait BinaryRepr

Source
pub trait BinaryRepr<Size = u32>:
    Sized
    + Not<Output = Self>
    + BitAnd<Output = Self>
    + BitOr<Output = Self>
    + BitXor<Output = Self>
    + Shl<Size, Output = Self>
    + Shr<Size, Output = Self>
    + BitAndAssign
    + BitOrAssign
    + BitXorAssign
    + ShlAssign<Size>
    + ShrAssign<Size> {
    // Required methods
    fn count_ones(self) -> Size;
    fn count_zeros(self) -> Size;
    fn leading_ones(self) -> Size;
    fn leading_zeros(self) -> Size;
    fn reverse_bits(self) -> Self;
    fn rotate_left(self, n: Size) -> Self;
    fn rotate_right(self, n: Size) -> Self;
    fn swap_bytes(self) -> Self;
    fn trailing_ones(self) -> Size;
    fn trailing_zeros(self) -> Size;
}
Expand description

Trait for operations of integer in binary representation.

Required Methods§

Source

fn count_ones(self) -> Size

Source

fn count_zeros(self) -> Size

Source

fn leading_ones(self) -> Size

Source

fn leading_zeros(self) -> Size

Source

fn reverse_bits(self) -> Self

Source

fn rotate_left(self, n: Size) -> Self

Source

fn rotate_right(self, n: Size) -> Self

Source

fn swap_bytes(self) -> Self

Source

fn trailing_ones(self) -> Size

Source

fn trailing_zeros(self) -> Size

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl BinaryRepr for i8

Source§

fn count_ones(self) -> u32

Source§

fn count_zeros(self) -> u32

Source§

fn leading_ones(self) -> u32

Source§

fn leading_zeros(self) -> u32

Source§

fn reverse_bits(self) -> Self

Source§

fn rotate_left(self, n: u32) -> Self

Source§

fn rotate_right(self, n: u32) -> Self

Source§

fn swap_bytes(self) -> Self

Source§

fn trailing_ones(self) -> u32

Source§

fn trailing_zeros(self) -> u32

Source§

impl BinaryRepr for i16

Source§

fn count_ones(self) -> u32

Source§

fn count_zeros(self) -> u32

Source§

fn leading_ones(self) -> u32

Source§

fn leading_zeros(self) -> u32

Source§

fn reverse_bits(self) -> Self

Source§

fn rotate_left(self, n: u32) -> Self

Source§

fn rotate_right(self, n: u32) -> Self

Source§

fn swap_bytes(self) -> Self

Source§

fn trailing_ones(self) -> u32

Source§

fn trailing_zeros(self) -> u32

Source§

impl BinaryRepr for i32

Source§

fn count_ones(self) -> u32

Source§

fn count_zeros(self) -> u32

Source§

fn leading_ones(self) -> u32

Source§

fn leading_zeros(self) -> u32

Source§

fn reverse_bits(self) -> Self

Source§

fn rotate_left(self, n: u32) -> Self

Source§

fn rotate_right(self, n: u32) -> Self

Source§

fn swap_bytes(self) -> Self

Source§

fn trailing_ones(self) -> u32

Source§

fn trailing_zeros(self) -> u32

Source§

impl BinaryRepr for i64

Source§

fn count_ones(self) -> u32

Source§

fn count_zeros(self) -> u32

Source§

fn leading_ones(self) -> u32

Source§

fn leading_zeros(self) -> u32

Source§

fn reverse_bits(self) -> Self

Source§

fn rotate_left(self, n: u32) -> Self

Source§

fn rotate_right(self, n: u32) -> Self

Source§

fn swap_bytes(self) -> Self

Source§

fn trailing_ones(self) -> u32

Source§

fn trailing_zeros(self) -> u32

Source§

impl BinaryRepr for i128

Source§

fn count_ones(self) -> u32

Source§

fn count_zeros(self) -> u32

Source§

fn leading_ones(self) -> u32

Source§

fn leading_zeros(self) -> u32

Source§

fn reverse_bits(self) -> Self

Source§

fn rotate_left(self, n: u32) -> Self

Source§

fn rotate_right(self, n: u32) -> Self

Source§

fn swap_bytes(self) -> Self

Source§

fn trailing_ones(self) -> u32

Source§

fn trailing_zeros(self) -> u32

Source§

impl BinaryRepr for isize

Source§

fn count_ones(self) -> u32

Source§

fn count_zeros(self) -> u32

Source§

fn leading_ones(self) -> u32

Source§

fn leading_zeros(self) -> u32

Source§

fn reverse_bits(self) -> Self

Source§

fn rotate_left(self, n: u32) -> Self

Source§

fn rotate_right(self, n: u32) -> Self

Source§

fn swap_bytes(self) -> Self

Source§

fn trailing_ones(self) -> u32

Source§

fn trailing_zeros(self) -> u32

Source§

impl BinaryRepr for u8

Source§

fn count_ones(self) -> u32

Source§

fn count_zeros(self) -> u32

Source§

fn leading_ones(self) -> u32

Source§

fn leading_zeros(self) -> u32

Source§

fn reverse_bits(self) -> Self

Source§

fn rotate_left(self, n: u32) -> Self

Source§

fn rotate_right(self, n: u32) -> Self

Source§

fn swap_bytes(self) -> Self

Source§

fn trailing_ones(self) -> u32

Source§

fn trailing_zeros(self) -> u32

Source§

impl BinaryRepr for u16

Source§

fn count_ones(self) -> u32

Source§

fn count_zeros(self) -> u32

Source§

fn leading_ones(self) -> u32

Source§

fn leading_zeros(self) -> u32

Source§

fn reverse_bits(self) -> Self

Source§

fn rotate_left(self, n: u32) -> Self

Source§

fn rotate_right(self, n: u32) -> Self

Source§

fn swap_bytes(self) -> Self

Source§

fn trailing_ones(self) -> u32

Source§

fn trailing_zeros(self) -> u32

Source§

impl BinaryRepr for u32

Source§

fn count_ones(self) -> u32

Source§

fn count_zeros(self) -> u32

Source§

fn leading_ones(self) -> u32

Source§

fn leading_zeros(self) -> u32

Source§

fn reverse_bits(self) -> Self

Source§

fn rotate_left(self, n: u32) -> Self

Source§

fn rotate_right(self, n: u32) -> Self

Source§

fn swap_bytes(self) -> Self

Source§

fn trailing_ones(self) -> u32

Source§

fn trailing_zeros(self) -> u32

Source§

impl BinaryRepr for u64

Source§

fn count_ones(self) -> u32

Source§

fn count_zeros(self) -> u32

Source§

fn leading_ones(self) -> u32

Source§

fn leading_zeros(self) -> u32

Source§

fn reverse_bits(self) -> Self

Source§

fn rotate_left(self, n: u32) -> Self

Source§

fn rotate_right(self, n: u32) -> Self

Source§

fn swap_bytes(self) -> Self

Source§

fn trailing_ones(self) -> u32

Source§

fn trailing_zeros(self) -> u32

Source§

impl BinaryRepr for u128

Source§

fn count_ones(self) -> u32

Source§

fn count_zeros(self) -> u32

Source§

fn leading_ones(self) -> u32

Source§

fn leading_zeros(self) -> u32

Source§

fn reverse_bits(self) -> Self

Source§

fn rotate_left(self, n: u32) -> Self

Source§

fn rotate_right(self, n: u32) -> Self

Source§

fn swap_bytes(self) -> Self

Source§

fn trailing_ones(self) -> u32

Source§

fn trailing_zeros(self) -> u32

Source§

impl BinaryRepr for usize

Source§

fn count_ones(self) -> u32

Source§

fn count_zeros(self) -> u32

Source§

fn leading_ones(self) -> u32

Source§

fn leading_zeros(self) -> u32

Source§

fn reverse_bits(self) -> Self

Source§

fn rotate_left(self, n: u32) -> Self

Source§

fn rotate_right(self, n: u32) -> Self

Source§

fn swap_bytes(self) -> Self

Source§

fn trailing_ones(self) -> u32

Source§

fn trailing_zeros(self) -> u32

Implementors§