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.

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 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§