confy 0.2.0

Compile-time configuration file reading
docs.rs failed to build confy-0.2.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: confy-0.6.1

Confy: compile-time configuration

Confy is a Rust compiler plugin for reading and using a TOML configuration file at compile-time.

Usage example

Add Confy to your Cargo.toml

[dependencies]
confy = "0.1.0"

And then you can use it like this:

#![feature(plugin)]
#![plugin(confy(file="Config.toml"))]

fn main() {
    assert_eq!(config!("string"), "value");
    assert_eq!(config!("int"), 42);
    assert_eq!(config!("bool"), false);
    assert_eq!(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.

License

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.