configuer

Crates.ioconfiguer
lib.rsconfiguer
version0.1.12
sourcesrc
created_at2020-07-19 14:17:31.078943
updated_at2021-02-05 08:31:28.598086
descriptionTiny lib to help you organize your configuration data
homepagehttps://github.com/Milesq/configuer
repository
max_upload_size
id266869
size10,359
Miłosz Wiśniewski (Milesq)

documentation

README

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

cargo fmt