Skip to main content

BitFlag

Trait BitFlag 

Source
pub trait BitFlag: Copy {
    const ALL_BITS: u8;

    // Required method
    fn bits(self) -> u8;
}
Expand description

A single bit flag backed by a u8 mask.

Required Associated Constants§

Source

const ALL_BITS: u8

Bitwise-OR of every flag — the bits BitFlags::from_bits accepts.

Required Methods§

Source

fn bits(self) -> u8

This flag’s single-bit value.

Implementations must return exactly one set bit, and that bit must be part of ALL_BITS. From and BitOr rely on this so a single flag always converts to a valid one-element set.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§