shiny_common/
dyn_configuration.rs

1use serde::de::DeserializeOwned;
2use serde::Serialize;
3
4pub trait DynConfigurationKey {
5    type Value: DeserializeOwned + Serialize;
6
7    fn path(&self) -> &'static str;
8}
9
10#[macro_export]
11macro_rules! configuration_keys {
12    ($($key_ident:ident($key:literal, $value:ident)),* ) => {
13        $(
14            pub struct $key_ident;
15            impl $crate::dyn_configuration::DynConfigurationKey for $key_ident {
16                type Value = $value;
17                fn path(&self) -> &'static str {
18                    $key
19                }
20            }
21        )*
22    };
23}