doko
Run methods in submodules by name
Overview
doko lets you include and run a method from a known submodule without importing and creating the
map from name to method yourself. Behind the scenes, the doko::doko! macro:
- Finds all Rust files in the specified directory,
- Includes them with
mod - Creates function
doko_<function>that takes a module name and returns<module name>::<function>. You can then call this function with whatever arguments you need.
Created to improve project layout for things like Project Euler and Advent of Code.
Usage
Project Layout
project/
└──── src/
├──── main.rs
└──── submod/
├───── a.rs
└───── b.rs
project/src/submod/a.rs
project/src/submod/b.rs
project/src/main.rs
doko!;
TODO
- Provide a cleaner API than generated functions (i.e.
let registry = doko::doko!(...); registry.run(<module>);)