pub struct Ini {
pub config_map: BTreeMap<String, BTreeMap<String, String>>,
/* private fields */
}Expand description
Load INI files into a structured BTreeMap, then edit them. Can also create new INI files. You can access the data directly via config_map, or use the provided functions. This only works on Windows and Linux
Fields§
§config_map: BTreeMap<String, BTreeMap<String, String>>Implementations§
Source§impl Ini
impl Ini
Sourcepub fn new(location: String) -> Result<Ini, Error>
pub fn new(location: String) -> Result<Ini, Error>
Load in an INI file and return its structure. If the file doesn’t exist, then returns empty structure.
Sourcepub fn save(&self) -> Result<usize, Error>
pub fn save(&self) -> Result<usize, Error>
Save an INI file after being edited. Only functions correctly on Windows and Linux. Ok will contain the size in bytes of the file after writing. All comments in the INI file will be lost by doing this.
Sourcepub fn set(&mut self, section: &str, key: &str, value: &str)
pub fn set(&mut self, section: &str, key: &str, value: &str)
Set a value in the INI file. If the section doesn’t exist, it will be created. If the key doesn’t exist, it will be created. This will not save the file.
Sourcepub fn remove(&mut self, section: &str, key: &str)
pub fn remove(&mut self, section: &str, key: &str)
Remove a key from the INI file. If the section doesn’t exist, it will be created. If the key doesn’t exist, it will be created. This will not save the file.
Sourcepub fn remove_section(&mut self, section: &str)
pub fn remove_section(&mut self, section: &str)
Remove a section from the INI file. This will not save the file.