smart_keymap::key::layered

Trait Layers

Source
pub trait Layers<K: Key>: Copy + Debug {
    // Required methods
    fn highest_active_key<LS: LayerState>(&self, layer_state: &LS) -> Option<K>;
    fn from_iterable<I: IntoIterator<Item = Option<K>>>(
        keys: I,
    ) -> Result<Self, LayersError>;
}
Expand description

Trait for layers of LayeredKey.

Required Methods§

Source

fn highest_active_key<LS: LayerState>(&self, layer_state: &LS) -> Option<K>

Get the highest active key, if any, for the given LayerState.

Source

fn from_iterable<I: IntoIterator<Item = Option<K>>>( keys: I, ) -> Result<Self, LayersError>

Constructs layers; return Err if the iterable has more keys than Layers can store.

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<K: Key + Copy, const L: usize> Layers<K> for [Option<K>; L]

Source§

fn highest_active_key<LS: LayerState>(&self, layer_state: &LS) -> Option<K>

Source§

fn from_iterable<I: IntoIterator<Item = Option<K>>>( keys: I, ) -> Result<Self, LayersError>

Implementors§