keyboard_codes/types/code_mapper.rs
1use super::Platform;
2
3/// Trait for types that can be converted to and from platform-specific key codes
4pub trait KeyCodeMapper {
5 /// Convert the key or modifier to a platform-specific code
6 fn to_code(&self, platform: Platform) -> usize;
7
8 /// Parse a key or modifier from a platform-specific code
9 fn from_code(code: usize, platform: Platform) -> Option<Self>
10 where
11 Self: Sized;
12}