Light library to read/write ini files.
ini
[table_name]
key = value
```rust use prettyini::{ini, inifile};
fn main() { let mut file = inifile::IniFile::default(); file.setpath("demo.ini");
let mut ini = ini::Ini::default();
ini.load(&mut file).unwrap();
let var_iter = ini.get_ref_mut(ini::TABLE_NAME_ROOT, "iter").unwrap();
var_iter.set(var_iter.parse::<i32>().unwrap() + 1);
println!("All keys contained in: \"Next\"");
for key in ini
.get_all_keys_in_table("next")
.expect("No key found in Next")
{
println!("- {}", key);
}
file.save(&mut ini);
}
```
Pre/Post Process
In the IniFile you can add some process using a ProcessAction.
Called before assign the file content to the buffer.
```rust let action = Some(Box::new(|buffer| { // Do nothing return buffer; }));
inifile.addpre_process(action); ```
Called before saving the file.
```rust let action = Some(Box::new(|buffer| { // Do nothing return buffer; }));
inifile.addpost_process(action); ```