Crates.io | configstore |
lib.rs | configstore |
version | 0.1.3 |
source | src |
created_at | 2020-05-18 02:40:46.380855 |
updated_at | 2020-05-25 23:37:31.561108 |
description | Library to store configurations of applications locally without having to worry about directories or platforms |
homepage | https://github.com/tarikeshaq/configstore |
repository | https://github.com/tarikeshaq/configstore |
max_upload_size | |
id | 242855 |
size | 28,035 |
Configstore is a library that allows you to store your configurations locally without having to worry about the directories or the platform
To use configstore
, add this to your Cargo.toml
:
[dependencies]
configstore = "0.1"
use configstore::{Configstore, AppUI};
fn main() {
let config_store = Configstore::new("myApp", AppUI::CommandLine).unwrap();
}
Configstore supports any value that implements Deserialize and Serialize
use serde_derive::*;
use configstore::{Configstore, AppUI};
#[derive(Deserialize, Serialize, Eq, PartialEq, Debug, Clone)]
struct Value {
text: String,
num: u32
}
let config_store = Configstore::new("myApp", AppUI::CommandLine).unwrap();
let value = Value {text: "hello world".to_string(), num: 4343};
config_store.set("key", value.clone()).unwrap();
let same_value: Value = config_store.get("key").unwrap();
assert_eq!(value, same_value);
Configstore will store the configuration files under your platforms native config directory based on platform-dirs
All contributions are welcome, feel free to file an issue or even a pull-request 🤝
This project is licensed under the Mozilla Public License 2.0