axconfig-macros
Procedural macros for converting TOML format configurations to equivalent Rust constant definitions.
Example
!;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
parse_configs
Value types are necessary for generating Rust constant definitions. Types can be specified by the comment following the config item. Currently supported types are bool
, int
, uint
, str
, (type1, type2, ...)
for tuples, and [type]
for arrays. If no type is specified, it will try to infer the type from the value.
The above example will generate the following constants:
pub const ARE_YOU_OK: bool = true;
pub const ONE_TWO_THREE: usize = 123;
You can also include the configuration file directly:
!;
// or specify the config file path via an environment variable
include_configs!;
// or with a fallback path if the environment variable is not set
include_configs!;
include_configs