3 releases (breaking)
Uses new Rust 2024
0.3.0 | Apr 7, 2025 |
---|---|
0.2.0 | Apr 4, 2025 |
0.1.0 | Apr 4, 2025 |
#1189 in Parser implementations
370 downloads per month
Used in rsa_ui
110KB
3K
SLoC
Ronf
A configuration library with saving based on config-rs.
Examples
use ronf::prelude::{Config, File, FileFormat};
fn main() {
let config = Config::builder()
.add(File::new_str(
"test_file",
FileFormat::Json,
"{\"key\": \"value\"}",
))
.build()
.unwrap();
println!("\"key\": {}", config.get("key").unwrap());
}
For more examples, check examples/
. Run with cargo run --example FILE_NAME
.
Features
ordered
- Uses HashMap fromindexmap
instead ofstd::collections
to preserve order of arrays;load_after_build
- Enables loading saves onConfig
(After building withConfigBuilder::build()
);read_file
- Add functions to readFile
from path;env
- Adds.env()
onConfigBuilder
to overwrite keys with env vars.
File formats
ini
- Load Ini files.json
- Load Json files.yaml
- Load Yaml files.toml
- Load Toml files.ron
- Load Ron files.
Dependencies
~0.1–1MB
~22K SLoC