keyboard-codes 0.2.0

Cross-platform keyboard key code mapping and conversion
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
use super::Platform;

/// Trait for types that can be converted to and from platform-specific key codes
pub trait KeyCodeMapper {
    /// Convert the key or modifier to a platform-specific code
    fn to_code(&self, platform: Platform) -> usize;

    /// Parse a key or modifier from a platform-specific code
    fn from_code(code: usize, platform: Platform) -> Option<Self>
    where
        Self: Sized;
}