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
- Host: GitHub
- URL: https://github.com/shaybox/derive-config
- Owner: ShayBox
- License: mit
- Created: 2024-02-01T00:47:45.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2024-11-04T11:37:22.000Z (over 1 year ago)
- Last Synced: 2025-03-28T13:48:13.447Z (about 1 year ago)
- Language: Rust
- Homepage: https://crates.io/crates/derive-config
- Size: 31.3 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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);
}
```