configurator

Crates.ioconfigurator
lib.rsconfigurator
version0.1.0
sourcesrc
created_at2018-03-14 07:58:04.315426
updated_at2018-03-14 07:58:04.315426
descriptionStatically-Typed Configuration Structs / Files for Rust.
homepage
repositoryhttps://github.com/innectic/configurator
max_upload_size
id55500
size3,615
Innectic (Innectic)

documentation

README

Configurator

Configurator makes statically-typed configuration for Rust easy.

Example

main.rs:

#[macro_use]
extern crate serde_derive;
extern crate serde_json;

#[macro_use]
extern crate configurator;

use std::fs::File;
use std::io::prelude::*;

#[derive(Debug, Deserialize)]
struct Testing {
	a: String
}

fn main() {
	match load_config!(Testing, "config.json") {
		Ok(c) => println!("{:?}", c),
		Err(e) => println!("Encountered an error: {}", e)
	}
}

config.json:

{
	"a": "Testing all the things"
}

Result:

Testing { a: "Testing all the things" }

Unfortunately, we currently rely on serde for JSON-to-file conversions.

Commit count: 0

cargo fmt