Confy is a Rust compiler plugin for reading and using a TOML configuration file at compile-time.
Add Confy to your Cargo.toml
toml
[dependencies]
confy = "0.1.0"
And then you can use it like this: ```rust
fn main() { asserteq!(config!("string"), "value"); asserteq!(config!("int"), 42); asserteq!(config!("bool"), false); asserteq!(config!("float"), 78.8); assert_eq!(config!("array"), vec![3, 4, 5]);
// You can specify a default, just in case
assert_eq!(config!("key not found", "foo"), "foo");
} ```
You can retrieve all TOML types except for table: string, integers, floats, and boolean values.
Confy is licensed under either of Apache License Version 2.0 or MIT license at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.