#data #help #tiny #lib #organize #configuration #model

configuer

Tiny lib to help you organize your configuration data

4 releases

0.1.12 Feb 5, 2021
0.1.11 Jul 22, 2020
0.1.1 Jul 19, 2020
0.1.0 Jul 19, 2020

#522 in Configuration

Download history 10/week @ 2024-02-26 54/week @ 2024-04-01

54 downloads per month

MIT license

5KB
80 lines

Configuer

dependency status

(name inspired by dialoguer ;D)

Configuer is a tiny lib which will help you organize your configuration data

Configuer::new creates new instance of Configuer. You must provide T parameter which specify data model.

Example

use configuer::Configuer;
use serde::{Deserialize, Serialize};

// Model must implement Serialize, Deserialize, CLone and Default. Debug is unneeded
#[derive(Serialize, Deserialize, Clone, Default, Debug)]
struct MyData {
    user_name: String,
}

fn main() {
    let mut config = Configuer::with_file("myIniFileName").on_create(|| {
        println!("I see you open this app very first time, please pass your name: ...");

        MyData {
            user_name: "Default user name".into(),
        }
    });

    println!("{:?}", config.data);
    config.save();
}

Dependencies

~0.7–1.7MB
~34K SLoC