smart_keymap::key::layered

Trait LayerState

Source
pub trait LayerState: Copy + Debug {
    // Required methods
    fn activate(&mut self, layer: LayerIndex);
    fn deactivate(&mut self, layer: LayerIndex);
    fn active_layers(&self) -> impl Iterator<Item = LayerIndex>;
}
Expand description

Tracks state of active layers.

Required Methods§

Source

fn activate(&mut self, layer: LayerIndex)

Activate the given layer.

Source

fn deactivate(&mut self, layer: LayerIndex)

Deactivate the given layer.

Source

fn active_layers(&self) -> impl Iterator<Item = LayerIndex>

Get the active layers, from highest active layer to lowest.

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<const L: usize> LayerState for [bool; L]

Source§

fn activate(&mut self, layer: LayerIndex)

Source§

fn deactivate(&mut self, layer: LayerIndex)

Source§

fn active_layers(&self) -> impl Iterator<Item = LayerIndex>

Implementors§