Skip to main content

KeyboardLayout

Trait KeyboardLayout 

Source
pub trait KeyboardLayout {
    // Required methods
    fn map_keycode(
        &self,
        keycode: KeyCode,
        modifiers: &Modifiers,
        handle_ctrl: HandleControl,
    ) -> DecodedKey;
    fn get_physical(&self) -> PhysicalKeyboard;
}
Expand description

Describes a Keyboard Layout.

Layouts might include “en_US”, or “en_GB”, or “de_GR”.

Required Methods§

Source

fn map_keycode( &self, keycode: KeyCode, modifiers: &Modifiers, handle_ctrl: HandleControl, ) -> DecodedKey

Convert a KeyCode enum to a Unicode character, if possible. KeyCode::A maps to DecodedKey::Unicode('a') (or DecodedKey::Unicode('A') if shifted), while KeyCode::LAlt becomes DecodedKey::RawKey(KeyCode::LAlt) because there’s no Unicode equivalent.

Source

fn get_physical(&self) -> PhysicalKeyboard

Which physical keyboard does this layout work on?

Implementors§