[go: up one dir, main page]

crokey 1.1.0

Parse and describe keys - helping incorporate keybindings in terminal applications
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use {
    crossterm::event::{KeyCode, KeyEvent, KeyModifiers},
};

/// Return the raw char if the crossterm key event is a letter event.
///
/// Case of the code is not normalized, just as in the original event.
pub const fn as_letter(key: KeyEvent) -> Option<char> {
    match key {
        KeyEvent {
            code: KeyCode::Char(l),
            modifiers: KeyModifiers::NONE,
            ..
        } => Some(l),
        _ => None,
    }
}