ini_puga
handles ini files in an easy way, without dealing with errors(1)
and thanks to generic types, only 2 methods get
and get_vector
are enought to
get an integer, float, boolen, and so on.
(1) Load
is the only one that may returns a Result IO:Error.
```rust use ini_puga::Ini;
const DEFAULT_CONFIG: &str = r#" my value without section = true pi=3.14159 [config] theme = Dark text scale = 1.2 empty value = screen width = 1080 resolutions = 640,480,3.5,whatever,720,1080 resolutions = use plugins = true themes path = themes/ plugins path = plugins/
[user data] name = José Puga id = 700101 fav lang = Rust fav pet = Rustacean "#;
let mut ini = Ini::new(); ini.read(DEFAULTCONFIG.tostring()); // Of course, you can also load from a file. // ini.load("config.ini").expect("*ERROR OPENING FILE *");
asserteq!(ini.get::
//Vectors. Non valid values are inserted in the vector as default value
let v = ini.getvector::
let noname: String = String::from("anonymous");
assertne!(
ini.get::
// Check sections and keys asserteq!(ini.sectionexists("config"), true); asserteq!(ini.keyexists("NONEXISTENT section", "foo"), false);
// Case sensitive asserteq!(ini.keyexists("", "pi"), true); asserteq!(ini.keyexists("", "PI"), false); ```
License: MIT