cranelift_bitset::scalar

Trait ScalarBitSetStorage

source
pub trait ScalarBitSetStorage:
    Default
    + From<u8>
    + Shl<u8, Output = Self>
    + Shr<u8, Output = Self>
    + BitAnd<Output = Self>
    + BitOr<Output = Self>
    + Not<Output = Self>
    + Sub<Output = Self>
    + Add<Output = Self>
    + PartialEq
    + Copy {
    // Required methods
    fn leading_zeros(self) -> u8;
    fn trailing_zeros(self) -> u8;
    fn count_ones(self) -> u8;
}
Expand description

A trait implemented by all integers that can be used as the backing storage for a ScalarBitSet.

You shouldn’t have to implement this yourself, it is already implemented for u{8,16,32,64,128} and if you need more bits than that, then use CompoundBitSet instead.

Required Methods§

source

fn leading_zeros(self) -> u8

Count the number of leading zeros.

source

fn trailing_zeros(self) -> u8

Count the number of trailing zeros.

source

fn count_ones(self) -> u8

Count the number of bits set in this integer.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl ScalarBitSetStorage for u8

source§

impl ScalarBitSetStorage for u16

source§

impl ScalarBitSetStorage for u32

source§

impl ScalarBitSetStorage for u64

source§

impl ScalarBitSetStorage for u128

source§

impl ScalarBitSetStorage for usize

Implementors§