Crates.io | configuer |
lib.rs | configuer |
version | 0.1.12 |
source | src |
created_at | 2020-07-19 14:17:31.078943 |
updated_at | 2021-02-05 08:31:28.598086 |
description | Tiny lib to help you organize your configuration data |
homepage | https://github.com/Milesq/configuer |
repository | |
max_upload_size | |
id | 266869 |
size | 10,359 |
(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.
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();
}