#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

#932 in Configuration

Download history 47/week @ 2024-07-29 4/week @ 2024-08-26 22/week @ 2024-09-16 19/week @ 2024-09-23 25/week @ 2024-09-30 171/week @ 2024-10-07 147/week @ 2024-10-14 34/week @ 2024-10-21 47/week @ 2024-10-28 103/week @ 2024-11-04 14/week @ 2024-11-11

212 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

~235–680KB
~16K SLoC