2 releases
0.9.1 | Feb 24, 2022 |
---|---|
0.9.0 | Feb 20, 2022 |
#104 in #yaml-config
Used in kalgan
12KB
172 lines
kalgan-config
Collection of functions to retrieve data and settings parameters defined in yaml files used by Kalgan Framework.
Examples
This is the yaml file to be used in the following tests:
## tests/settings.yaml
user:
name: John
is_real: false
age: 39
height: 1.78
children:
- Huey
- Dewey
- Louie
use kalgan_config::Config;
let config: Config = Config::new("tests/settings.yaml");
assert_eq!(config.get("user.name").unwrap(), "John");
assert_eq!(config.get_string("user.name").unwrap(), "John".to_string());
assert_eq!(config.get_bool("user.is_real").unwrap(), false);
assert_eq!(config.get_number("user.age").unwrap(), 39);
assert_eq!(config.get_float("user.height").unwrap(), 1.78);
assert_eq!(config.get_vec("user.children").unwrap(), vec!["Huey", "Dewey", "Louie"]);
Documentation
For further information please visit:
License
This crate is licensed under either of the following licenses:
Dependencies
~2MB
~40K SLoC