An open API service indexing awesome lists of open source software.

https://github.com/shaybox/derive-config

My simple configuration library
https://github.com/shaybox/derive-config

Last synced: 6 months ago
JSON representation

My simple configuration library

Awesome Lists containing this project

README

          

# Derive Config

My simple configuration library

```rust
use derive_config::DeriveTomlConfig;
use serde::{Deserialize, Serialize};

#[derive(Debug, Default, DeriveTomlConfig, Deserialize, Serialize)]
struct ExampleConfig {
foo: String,
}

fn main() {
let mut config = ExampleConfig::load().unwrap_or_default();
println!("{}", config.foo);

config.foo = String::from(if config.foo == "bar" { "baz" } else { "bar" });
config.save().expect("Failed to save");
println!("{}", config.foo);
}
```