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