Confy is a compiler plugin for reading TOML configuration files at compile-time. You can use it like this:
#![feature(plugin)]
#![plugin(confy(file="Config.toml"))]
fn main() {
// This will read the "string" and "bool" entries in Config.toml
assert_eq!(config!("string"), "value");
assert_eq!(config!("bool"), false);
// You can also specify a default value
assert_eq!(config!("key not found", "foo"), "foo");
}
As this is my first compiler plugin, I would appreciate any suggestion to improve the code! Also, if think of a way it could be enhanced, let me know.