derive-macros

Crates.ioderive-macros
lib.rsderive-macros
version2.3.0
sourcesrc
created_at2024-02-06 04:26:16.295285
updated_at2024-10-06 23:18:52.951697
descriptionMy personal configuration library
homepage
repositoryhttps://github.com/ShayBox/Derive-Config
max_upload_size
id1128445
size5,492
Shayne Hartford (ShayBox)

documentation

README

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);
}
Commit count: 12

cargo fmt