mouse-codes 0.1.0

Cross-platform mouse button 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 mouse codes
pub trait CodeMapper {
    /// Convert the button to a platform-specific code
    fn to_code(&self, platform: Platform) -> usize;

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