#serde-derive #derive #serde

macro derive-macros

My personal configuration library

6 stable releases

2.3.0 Oct 6, 2024
2.2.0 Jul 26, 2024
2.1.1 Feb 16, 2024
1.0.0 Feb 6, 2024

#817 in Configuration

Download history 153/week @ 2024-07-26 10/week @ 2024-08-02 1/week @ 2024-08-23 3/week @ 2024-08-30 17/week @ 2024-09-13 20/week @ 2024-09-20 11/week @ 2024-09-27 169/week @ 2024-10-04 148/week @ 2024-10-11 41/week @ 2024-10-18 46/week @ 2024-10-25 66/week @ 2024-11-01

307 downloads per month
Used in 2 crates (via derive-config)

MIT license

6KB
86 lines

Derive Config

My simple configuration library

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);
}

Dependencies

~230–670KB
~16K SLoC