Trait Bits

Source
pub trait Bits:
    Copy
    + Eq
    + PartialEq
where Self: Binary + Shl<u16, Output = Self> + Shr<u16, Output = Self> + BitAnd<Output = Self>,
{ const BITS: u16; const ZERO: Self; const ONE: Self; // Provided method fn is_zero(self) -> bool { ... } }
Expand description

Types suitable for bit representations.

Required Associated Constants§

Source

const BITS: u16

The number of bits.

Source

const ZERO: Self

The value 0.

Source

const ONE: Self

The value 1.

Provided Methods§

Source

fn is_zero(self) -> bool

Test if the value is zero.

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 Bits for u32

Source§

const BITS: u16 = 32u16

Source§

const ZERO: Self = 0u32

Source§

const ONE: Self = 1u32

Source§

impl Bits for u64

Source§

const BITS: u16 = 64u16

Source§

const ZERO: Self = 0u64

Source§

const ONE: Self = 1u64

Implementors§