diff options
Diffstat (limited to 'macros/src/util/mod.rs')
-rw-r--r-- | macros/src/util/mod.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/macros/src/util/mod.rs b/macros/src/util/mod.rs index 0705853..d3edb67 100644 --- a/macros/src/util/mod.rs +++ b/macros/src/util/mod.rs @@ -1,4 +1,27 @@ +pub mod error; pub mod item_impl; pub mod iterator_ext; pub mod string; pub mod syn_path; + +macro_rules! to_option { + ($($tokens: tt)+) => { + Some($($tokens)+) + }; + + () => { + None + }; +} + +macro_rules! or { + (($($tokens: tt)+) else ($($default: tt)*)) => { + $($tokens)* + }; + + (() else ($($default: tt)*)) => { + $($default)* + }; +} + +pub(crate) use {or, to_option}; |