Skip to main content

BitRepr

Trait BitRepr 

Source
pub trait BitRepr:
    Copy
    + Eq
    + Ord
    + Hash
    + Default
    + Debug
    + Send
    + Sync
    + 'static
    + BitAnd<Output = Self>
    + BitAndAssign
    + BitOr<Output = Self>
    + BitOrAssign
    + Not<Output = Self>
    + Shl<usize, Output = Self>
    + Shr<usize, Output = Self>
    + ShrAssign<usize>
    + Add<Output = Self>
    + Sub<Output = Self> {
    const BITS: usize;
    const ZERO: Self;
    const ONE: Self;
    const MAX: Self;

    // Required methods
    fn count_ones(self) -> u32;
    fn reverse_bits(self) -> Self;
    fn to_usize(self) -> Option<usize>;
}
Expand description

The unsigned word backing a BitSeq. Implemented for u8u128.

Required Associated Constants§

Source

const BITS: usize

Source

const ZERO: Self

Source

const ONE: Self

Source

const MAX: Self

Required Methods§

Source

fn count_ones(self) -> u32

Source

fn reverse_bits(self) -> Self

Source

fn to_usize(self) -> Option<usize>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl BitRepr for u8

Source§

const BITS: usize

Source§

const ZERO: Self = 0

Source§

const ONE: Self = 1

Source§

const MAX: Self = u8::MAX

Source§

fn count_ones(self) -> u32

Source§

fn reverse_bits(self) -> Self

Source§

fn to_usize(self) -> Option<usize>

Source§

impl BitRepr for u16

Source§

const BITS: usize

Source§

const ZERO: Self = 0

Source§

const ONE: Self = 1

Source§

const MAX: Self = u16::MAX

Source§

fn count_ones(self) -> u32

Source§

fn reverse_bits(self) -> Self

Source§

fn to_usize(self) -> Option<usize>

Source§

impl BitRepr for u32

Source§

const BITS: usize

Source§

const ZERO: Self = 0

Source§

const ONE: Self = 1

Source§

const MAX: Self = u32::MAX

Source§

fn count_ones(self) -> u32

Source§

fn reverse_bits(self) -> Self

Source§

fn to_usize(self) -> Option<usize>

Source§

impl BitRepr for u64

Source§

const BITS: usize

Source§

const ZERO: Self = 0

Source§

const ONE: Self = 1

Source§

const MAX: Self = u64::MAX

Source§

fn count_ones(self) -> u32

Source§

fn reverse_bits(self) -> Self

Source§

fn to_usize(self) -> Option<usize>

Source§

impl BitRepr for u128

Source§

const BITS: usize

Source§

const ZERO: Self = 0

Source§

const ONE: Self = 1

Source§

const MAX: Self = u128::MAX

Source§

fn count_ones(self) -> u32

Source§

fn reverse_bits(self) -> Self

Source§

fn to_usize(self) -> Option<usize>

Implementors§