BitBlockElement

Trait BitBlockElement 

Source
pub trait BitBlockElement:
    Not<Output = Self>
    + BitAnd<Output = Self>
    + BitOr<Output = Self>
    + BitXor<Output = Self>
    + Shl<u32, Output = Self>
    + Shr<u32, Output = Self>
    + BitAndAssign
    + BitOrAssign
    + Add<Output = Self>
    + Sub<Output = Self>
    + PartialEq
    + Sized
    + Copy
    + Clone
    + Binary
    + Default {
    const BIT_WIDTH: usize;
    const ZERO: Self;
    const ONE: Self;
    const MAX: Self;

    // Required methods
    fn count_ones(self) -> u32;
    fn leading_zeros(self) -> u32;
    fn wrapping_shl(self, rhs: u32) -> Self;
    fn wrapping_shr(self, rhs: u32) -> Self;
    fn clear_high_bits(self, rhs: u32) -> Self;
    fn clear_low_bits(self, rhs: u32) -> Self;
}

Required Associated Constants§

Source

const BIT_WIDTH: usize

Source

const ZERO: Self

Source

const ONE: Self

Source

const MAX: Self

Required Methods§

Source

fn count_ones(self) -> u32

Source

fn leading_zeros(self) -> u32

Source

fn wrapping_shl(self, rhs: u32) -> Self

Source

fn wrapping_shr(self, rhs: u32) -> Self

Source

fn clear_high_bits(self, rhs: u32) -> Self

Source

fn clear_low_bits(self, rhs: u32) -> Self

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 BitBlockElement for u8

Source§

const BIT_WIDTH: usize = 8usize

Source§

const ZERO: Self = 0u8

Source§

const ONE: Self = 1u8

Source§

const MAX: Self = 255u8

Source§

fn count_ones(self) -> u32

Source§

fn leading_zeros(self) -> u32

Source§

fn wrapping_shl(self, rhs: u32) -> Self

Source§

fn wrapping_shr(self, rhs: u32) -> Self

Source§

fn clear_high_bits(self, rhs: u32) -> Self

Source§

fn clear_low_bits(self, rhs: u32) -> Self

Source§

impl BitBlockElement for u16

Source§

const BIT_WIDTH: usize = 16usize

Source§

const ZERO: Self = 0u16

Source§

const ONE: Self = 1u16

Source§

const MAX: Self = 65_535u16

Source§

fn count_ones(self) -> u32

Source§

fn leading_zeros(self) -> u32

Source§

fn wrapping_shl(self, rhs: u32) -> Self

Source§

fn wrapping_shr(self, rhs: u32) -> Self

Source§

fn clear_high_bits(self, rhs: u32) -> Self

Source§

fn clear_low_bits(self, rhs: u32) -> Self

Source§

impl BitBlockElement for u32

Source§

const BIT_WIDTH: usize = 32usize

Source§

const ZERO: Self = 0u32

Source§

const ONE: Self = 1u32

Source§

const MAX: Self = 4_294_967_295u32

Source§

fn count_ones(self) -> u32

Source§

fn leading_zeros(self) -> u32

Source§

fn wrapping_shl(self, rhs: u32) -> Self

Source§

fn wrapping_shr(self, rhs: u32) -> Self

Source§

fn clear_high_bits(self, rhs: u32) -> Self

Source§

fn clear_low_bits(self, rhs: u32) -> Self

Source§

impl BitBlockElement for u64

Source§

const BIT_WIDTH: usize = 64usize

Source§

const ZERO: Self = 0u64

Source§

const ONE: Self = 1u64

Source§

const MAX: Self = 18_446_744_073_709_551_615u64

Source§

fn count_ones(self) -> u32

Source§

fn leading_zeros(self) -> u32

Source§

fn wrapping_shl(self, rhs: u32) -> Self

Source§

fn wrapping_shr(self, rhs: u32) -> Self

Source§

fn clear_high_bits(self, rhs: u32) -> Self

Source§

fn clear_low_bits(self, rhs: u32) -> Self

Implementors§