drone_macros_core/
macros.rs

1/// Unconditionally causes parsing to fail with the given error message.
2#[macro_export]
3macro_rules! parse_error {
4    ($($args:tt)*) => {
5        return ::syn::parse::Error::new(
6            ::proc_macro2::Span::call_site(),
7            format!($($args)*),
8        )
9        .to_compile_error()
10        .into()
11    };
12}
13
14/// Parses an identifier with a specific value, or throws an error otherwise.
15#[macro_export]
16macro_rules! parse_ident {
17    ($input:ident, $value:expr) => {
18        if $input.parse::<::syn::Ident>()? != $value {
19            return Err($input.error(format!("Expected `{}`", $value)));
20        }
21    };
22}