diff options
author | Griffin Smith <root@gws.fyi> | 2019-07-14T18·29-0400 |
---|---|---|
committer | Griffin Smith <root@gws.fyi> | 2019-07-14T18·29-0400 |
commit | 081146da30bcf1a17d9533c3dc9c735a3a558165 (patch) | |
tree | cfccab3ec7f2346897adc8d50c872d49e3b45fd3 /src/util/static_toml.rs | |
parent | 67d18b486c6376c7637b3494722ddf1eb525288c (diff) |
Allow static_cfg to include entire directories
Via new "toml_dir" and "json_dir" directives in the macro
Diffstat (limited to 'src/util/static_toml.rs')
-rw-r--r-- | src/util/static_toml.rs | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/src/util/static_toml.rs b/src/util/static_toml.rs deleted file mode 100644 index 7a930ee023c8..000000000000 --- a/src/util/static_toml.rs +++ /dev/null @@ -1,37 +0,0 @@ -macro_rules! __static_cfg_parse { - (toml_file, $e:expr) => { - toml::from_str($e) - }; - - (json_file, $e:expr) => { - json::from_str($e) - }; -} - -macro_rules! __static_cfg_inner { - ($(#[$attr:meta])* ($($vis:tt)*) static ref $N:ident : $T:ty = $kind:ident($filename:expr); $($t:tt)*) => { - static RAW: &'static str = include_str!($filename); - lazy_static! { - $(#[$attr])* static ref $N: $T = __static_cfg_parse!($kind, RAW).unwrap(); - } - - static_cfg!($($t)*); - } -} - -#[macro_export] -macro_rules! static_cfg { - ($(#[$attr:meta])* static ref $N:ident : $T:ty = $kind:ident($filename:expr); $($t:tt)*) => { - __static_cfg_inner!($(#[$attr])* () static ref $N : $T = $kind($filename); $($t)*); - }; - - ($(#[$attr:meta])* pub static ref $N:ident : $T:ty = $kind:ident($filename:expr); $($t:tt)*) => { - __static_cfg_inner!($(#[$attr])* (pub) static ref $N : $T = $kind($filename); $($t)*); - }; - - ($(#[$attr:meta])* pub ($($vis:tt)+) static ref $N:ident : $T:ty = $kind:ident($filename:expr); $($t:tt)*) => { - __static_cfg_inner!($(#[$attr])* (pub ($($vis)+)) static ref $N : $T = $kind($filename); $($t)*); - }; - - () => () -} |