Crate graze

Crate graze 

Source
Expand description

graze is a zero-boilerplate configuration library.

graze itself does not use serde as a dependency, but can easily be used alongside the serde ecosystem.

§Functions

§Examples

§Load a configuration using the toml crate

use serde::Deserialize;

#[derive(Deserialize)]
struct Config {
    message: String
}

let config: Config = graze::load_from_path("Config.toml", |c| toml::from_str(c))
    .expect("Could not load configuration");

println!("{}", config.message);

Enums§

ConfigurationError
The error type returned by functions which return a Result.

Functions§

load_from_path
Load a configuration from the file at the given path.
load_or_default
Load a configuration from the file at the given path, or use the default value if the file does not exist.
load_or_write_default
Load a configuration from the file at the given path, or use the default value if the file does not exist.

Type Aliases§

Result