rktk/drivers/interface/
mod.rs1#![allow(async_fn_in_trait)]
3
4pub mod debounce;
5pub mod display;
6pub mod dongle;
7pub mod encoder;
8pub mod keyscan;
9pub mod magnetic;
10pub mod mouse;
11pub mod reporter;
12pub mod rgb;
13pub mod split;
14pub mod storage;
15pub mod system;
16pub mod usb;
17pub mod wireless;
18
19pub trait Error: core::fmt::Debug + rktk_log::MaybeFormat {
20 fn kind(&self) -> ErrorKind {
21 ErrorKind::Other
22 }
23}
24
25#[non_exhaustive]
26pub enum ErrorKind {
27 NotSupported,
28 Other,
29}
30
31impl Error for core::convert::Infallible {
32 fn kind(&self) -> ErrorKind {
33 unreachable!()
34 }
35}
36
37macro_rules! generate_builder {
38 ($driver:ident) => {
39 paste::paste! {
40 pub trait [<$driver Builder>] {
41 type Output: $driver;
42 type Error: rktk_log::MaybeFormat;
43 async fn build(self) -> Result<(Self::Output, impl Future<Output = ()> + 'static), Self::Error>;
44 }
45 }
46 };
47}
48pub(crate) use generate_builder;