Trait pc_keyboard::KeyboardLayout

source ·
pub trait KeyboardLayout {
    // Required method
    fn map_keycode(
        &self,
        keycode: KeyCode,
        modifiers: &Modifiers,
        handle_ctrl: HandleControl,
    ) -> DecodedKey;
}
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.

Implementors§