XMacro
This crate provides two things:
- A library to generate code by repetively expanding macros. This is the primary objective of this crate as it enables code generation in a convenient way from other proc macros.
- The standalone
xmacro!{}andxmacro_items!{}macros to generate code using the library as it is useful on its own.
This crate supersedes the code_product crate.
XMacro expansion example
The name product is because it expands to the product (each by each) of all defined
sets. For example given are the two sets of defintions 'Foo and Bar' and 'This and That',
showing different syntactic variants:
# use xmacro;
#
# ; ;
# ; ;
xmacro!
or
# use xmacro;
#
# ; ;
# ; ;
xmacro!
either of the above will expand four times to:
#
# ; ;
# ; ;
Please refer to the README of the xmacro_lib crate for a elaborate
description of the macro syntax and semantic.