libset
A configuration file management library for Rust applications.
Add the library
Run cargo add libset or add it to Cargo.toml:
[]
= "0.1"
Usage
Start by creating a new Config object:
let config = new?;
Provide an application name, a version and optionally a prefix, then, a new directory will be added to your filesystem, this is where all the created files will be stored in.
Write a file.
let config = new?;
config.set_json?;
This wil store the file here:
$HOME/.config/org.example.Demo/v1/colors.json
Get a file.
let settings: Colors = config.get_json?;
Check out the examples!
Scopes
A scope is just a simple sub-directory stored inside your application's config directory, all subsequent files will be stored within that scope.
let config = new?;
config.set_json?;
This wil store the file here:
$HOME/.config/org.example.Demo/v1/appearance/colors.json
Available features
json- Enables json support, enabled by default.toml- Enables toml support.ron- Enables ron support.
Depending on which features you enable, you will get setter and getters methods suffixed by the file type.
Proposals
If you have a proposal for a new feature, open a new issue.