macro_rules! eager_macro_rules {
(
$dollar1:tt $id_1:ident
$(
$(#[$($metas:tt)*])*
macro_rules! $macro_name:ident {
$($rules:tt => $expansions:tt);* $(;)*
}
)+
) => { ... };
}
Expand description
Declares eager!-enabled macros.
§Usage
Wraps the usual macro_rules!
syntax. First an identifier must be given, preceded by ‘$’.
Then any number of macro declarations can be given using the usual macro_rules!
syntax.
Documentation and attributes are also given in the
usual way just before each macro_rules!
, i.e. inside eager_macro_rules!
.
Some restrictions apply to the macro_rules!
declarations:
- The identifier given at the beginning must not collide with any macro variable name used in any rule in any macro to be declared.
- No rules should accept
@eager
as the first token, as this could conflict with the implementation ofeager!
. Wildcards are acceptable, aseager_macro_rules!
will automatically resolve the ambiguity with theeager!
implementation.
§eager!
-enabling example
eager!-enabling the following macro:
/// Some documentation
#[macro_export]
macro_rules! some_macro{
()=>{};
}
is done by wrapping it in eager_macro_rules!
as follows:
#[macro_use] extern crate eager;
eager_macro_rules!{ $eager_1
/// Some documentation
#[macro_export]
macro_rules! some_macro{
()=>{};
}
}
where ()=>{};
is the list of rules that comprise the macro, and no macro variable is called
$eager_1
.