graze

Crates.iograze
lib.rsgraze
version0.1.0
sourcesrc
created_at2022-11-24 06:13:58.431272
updated_at2022-11-24 06:13:58.431272
descriptionA zero-boilerplate configuration library.
homepage
repositoryhttps://github.com/ImajinDevon/graze
max_upload_size
id722019
size10,523
Imajin (ImajinDevon)

documentation

README

graze

Rust build status badge Clippy check status badge Rustfmt check status badge

What is graze?

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

  • load_from_path
  • load_or_default
  • load_or_write_default

Examples

Load a configuration using the toml crate

use serde::Deserialize;

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

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

    println!("{}", config.message);
}
Commit count: 4

cargo fmt