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