RKTK API Docs RKTK Home Repo

rktk/hooks/interface/
mod.rs

1//! Hooks traits
2
3#![allow(async_fn_in_trait)]
4
5pub mod dongle;
6pub mod master;
7pub mod rgb;
8
9pub use common::CommonHooks;
10pub use master::MasterHooks;
11pub use rgb::RgbHooks;
12pub use slave::SlaveHooks;
13
14pub mod common {
15    use crate::{
16        config::Hand,
17        drivers::interface::{keyscan::KeyscanDriver, mouse::MouseDriver, storage::StorageDriver},
18    };
19
20    /// Hooks common for both master and slave side
21    pub trait CommonHooks {
22        async fn on_init(
23            &mut self,
24            _hand: Hand,
25            _key_scanner: &mut impl KeyscanDriver,
26            _mouse: Option<&mut impl MouseDriver>,
27            _storage: Option<&mut impl StorageDriver>,
28        ) {
29        }
30    }
31}
32
33pub mod slave {
34    use crate::drivers::interface::{keyscan::KeyscanDriver, mouse::MouseDriver};
35
36    pub trait SlaveHooks {
37        /// Called after slave side initialization.
38        async fn on_slave_init(
39            &mut self,
40            _key_scanner: &mut impl KeyscanDriver,
41            _mouse: Option<&mut impl MouseDriver>,
42        ) {
43        }
44    }
45}