Simple configuration library,Easier than .ini
~~~ c1 = value
c2 = value2 c3 = ccc3 c5 = 5c ~~~
~~~rust let mut cc = BufData::new(); cc.chgvalue("c1", "value"); cc.chgvalue("c2", "value2"); cc.chgvalue("c3", "value3"); if let Ok(_) = cc.save(None){ println!("file write success") }; ~~~
~~~rust if let Ok(mut cc) = BufData::loadfromiii("default.iii"){ cc.chgvalue("c3", "ccc3"); cc.chgvalue("c5", "5c"); if let Ok(_) = cc.save(None){ println!("file write success") }; }; ~~~
~~~rust if let Ok(cc) = BufData::loadfromiii("default.iii"){ if let Some(v) = cc.getvalue("c2"){ println!("K:{},V:{}","c2",v); } if let Some(v) = cc.getvalue("c5"){ println!("K:{},V:{}","c5",v); } }; ~~~
~~~rust let mut cc = BufData::new(); cc.chgvalue("c1", "value"); if let Ok() = cc.save(None){ println!("file write success") }; if let Ok() = cc.save(Some("file1.iii")){ println!("file write success") }; ~~~
If you want to read the numeric type,exp like:
~~~rust
let mut cc = BufData::new();
cc.chgvalue("c2", "33");
cc.chgvalue("c4", &true.to_string());
if let Some(v) = cc.getvalue("c2"){
if let Ok(number) = v.parse::