Trait input_linux::bitmask::BitmaskTrait
source · pub trait BitmaskTrait {
type Array: Sized;
type Index: Copy + IterableEnum;
const ZERO: Self::Array;
// Required methods
fn array_default() -> Self::Array;
fn array_slice(array: &Self::Array) -> &[u8] ⓘ;
fn array_slice_mut(array: &mut Self::Array) -> &mut [u8] ⓘ;
fn index(index: Self::Index) -> usize;
// Provided method
fn index_valid(_array: &Self::Array, _index: Self::Index) -> bool { ... }
}Expand description
A generic trait that can be used to index by a given type into a set of bits.
Required Associated Types§
sourcetype Index: Copy + IterableEnum
type Index: Copy + IterableEnum
The type that the bitmask can be indexed by.
Required Associated Constants§
Required Methods§
sourcefn array_default() -> Self::Array
fn array_default() -> Self::Array
The default empty state of the bitmask.
sourcefn array_slice(array: &Self::Array) -> &[u8] ⓘ
fn array_slice(array: &Self::Array) -> &[u8] ⓘ
A representation of the bitmask as a slice of bytes.
sourcefn array_slice_mut(array: &mut Self::Array) -> &mut [u8] ⓘ
fn array_slice_mut(array: &mut Self::Array) -> &mut [u8] ⓘ
A mutable representation of the bitmask as a slice of bytes.
Provided Methods§
sourcefn index_valid(_array: &Self::Array, _index: Self::Index) -> bool
fn index_valid(_array: &Self::Array, _index: Self::Index) -> bool
Validates whether a given index is valid and in range for the bitmask.
Dynamically allocated bitmasks may not be large enough to contain all indices.
Object Safety§
This trait is not object safe.