matchmaker/
lib.rs

1// event
2pub mod config;
3pub mod binds;
4pub mod action;
5pub mod event;
6
7pub mod message;
8pub mod render;
9pub mod ui;
10// picker
11pub mod nucleo;
12pub mod proc;
13mod selection;
14pub use selection::SelectionSet;
15mod matchmaker;
16pub use matchmaker::*;
17pub mod tui;
18
19// misc
20mod utils;
21mod aliases;
22pub mod errors;
23pub use aliases::*;
24pub use errors::*;
25
26#[macro_export]
27macro_rules! impl_int_wrapper {
28    ($name:ident, $inner:ty, $default:expr) => {
29        #[derive(Debug, Clone, Copy, Eq, serde::Deserialize, serde::Serialize)]
30        #[serde(transparent)]
31        pub struct $name(pub $inner);
32
33        impl Default for $name {
34            fn default() -> Self {
35                $name($default)
36            }
37        }
38
39        impl std::str::FromStr for $name {
40            type Err = std::num::ParseIntError;
41
42            fn from_str(s: &str) -> Result<Self, Self::Err> {
43                Ok($name(s.parse()?))
44            }
45        }
46
47        impl From<&$name> for $inner {
48            fn from(c: &$name) -> Self {
49                c.0
50            }
51        }
52
53        impl std::fmt::Display for $name {
54            fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
55                write!(f, "{}", self.0)
56            }
57        }
58
59        impl PartialEq for $name {
60            fn eq(&self, other: &Self) -> bool {
61                self.0 == other.0
62            }
63        }
64
65        impl std::ops::Deref for $name {
66            type Target = $inner;
67            fn deref(&self) -> &Self::Target { &self.0 }
68        }
69
70        impl std::ops::DerefMut for $name {
71            fn deref_mut(&mut self) -> &mut Self::Target { &mut self.0 }
72        }
73    };
74}