import!() { /* proc-macro */ }
Expand description
Returns a list of modules processed based on a configuration.
§Arguments
input
- A JSON containing the configuration.
§Example
This is based on the import-modules test directory.
§Inter Process and Post Process
Intermediary processes allow you to manipulate how the modules are processed.
§Input
ⓘ
use import_macro::import;
// The {} is replaced by the module.
let functions = import!({
"directory": "tests/math/",
"inter_process": "math::{}::handler,",
"post_process": "vec![{}]"
});
§Output
ⓘ
let functions = vec![
math::add::handler,
math::sub::handler,
];
§Module
Similar to intermediate process, this imports it by default as Rust module.
§Input
ⓘ
use import_macro::import;
import!({
"directory": "tests",
});
§Output
ⓘ
mod math;