mouse_codes/
lib.rs

1//! mouse-codes: Cross-platform mouse button code mapping and conversion
2//!
3//! This crate provides comprehensive mouse button definitions and cross-platform
4//! code mapping for Windows, Linux, and macOS.
5
6#![deny(missing_docs)]
7#![warn(clippy::all)]
8
9#[cfg(feature = "serde")]
10extern crate serde;
11
12#[cfg(feature = "phf")]
13extern crate phf;
14
15#[cfg(feature = "phf")]
16extern crate lazy_static;
17
18/// Error types for mouse parsing and mapping
19pub mod error;
20/// Mouse code mapping implementations
21pub mod mapping;
22/// Advanced mouse input parsing with alias support
23pub mod parser;
24/// Core type definitions for mouse buttons and platforms
25pub mod types;
26/// Utility functions and helpers
27pub mod utils;
28
29// Re-export main types for convenient access
30pub use error::MouseParseError;
31pub use mapping::custom::{CustomButton, CustomButtonMap};
32pub use types::{Button, CodeMapper, MouseEvent, Platform, ScrollDirection};
33
34// Re-export core parsing functions
35pub use mapping::standard::parse_button_ignore_case;
36
37// Re-export advanced parser functionality
38pub use parser::{parse_button_with_aliases, parse_mouse_input};
39
40// 保持向后兼容性,但标记为已弃用
41#[deprecated(since = "0.1.0", note = "Use Platform::current() instead")]
42/// Get the current platform based on compilation target
43///
44/// This function is deprecated. Use `Platform::current()` instead.
45pub fn current_platform() -> Platform {
46    Platform::current()
47}
48
49// 注意:移除了在 lib.rs 中的重复实现,所有方法实现都在各自的类型模块中