#configuration #data #help #organize #lib #tiny #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

#628 in Configuration

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.6–1.6MB
~31K SLoC