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
:
toml
[dependencies]
configstore = "0.1.1"
rust,ignore
use configstore::{Configstore, AppUI};
fn main() {
let config_store = Configstore::new("myApp", AppUI::CommandLine).unwrap();
}
Configstore supports any value that implements Deserialize and Serialize
```rust use serde_derive::*; use configstore::{Configstore, AppUI};
struct Value { text: String, num: u32 }
let config_store = Configstore::new("myApp", AppUI::CommandLine).unwrap();
let value = Value {text: "hello world".tostring(), num: 4343}; configstore.set("key", value.clone()).unwrap();
let samevalue: Value = configstore.get("key").unwrap(); asserteq!(value, samevalue); ```
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