pub struct Ini { /* private fields */ }Expand description
a settings object (one thread at a time)
Implementations§
Source§impl Ini
impl Ini
pub fn new() -> Ini
Sourcepub fn load(path: &str) -> Ini
pub fn load(path: &str) -> Ini
the parsed file; empty when it is missing or unreadable [ini_load]
Sourcepub fn load_checked(path: &str) -> Option<Ini>
pub fn load_checked(path: &str) -> Option<Ini>
like load, but None when the file exists and could not be read completely (unreadable or longer than FILE_MAX); a missing or empty file gives an empty Ini
Sourcepub fn save(&self, path: &str) -> bool
pub fn save(&self, path: &str) -> bool
Write through plat::write_file; missing directories are created. [ini_save]
Sourcepub fn section(&self, sec: &str) -> Vec<(&str, &str)>
pub fn section(&self, sec: &str) -> Vec<(&str, &str)>
every key of a section with its value, in file order (entries that are not UTF-8 are left out; sec “” = the keys before the first header)
Sourcepub fn sections(&self) -> Vec<&str>
pub fn sections(&self) -> Vec<&str>
the names of the sections in file order, each once (names that are not UTF-8 are left out; the keys before the first header are not a section here)
Sourcepub fn items(&self) -> Vec<Item<'_>>
pub fn items(&self) -> Vec<Item<'_>>
every header, key and malformed line in file order with its line number; blank lines and comments are left out
Sourcepub fn get(&self, sec: &str, key: &str) -> Option<&str>
pub fn get(&self, sec: &str, key: &str) -> Option<&str>
the value, or None when missing or not UTF-8 [ini_get]
pub fn get_bytes(&self, sec: &str, key: &str) -> Option<&[u8]>
Sourcepub fn get_f64(&self, sec: &str, key: &str, def: f64) -> f64
pub fn get_f64(&self, sec: &str, key: &str, def: f64) -> f64
the whole value must be the number [ini_get_f64]
Sourcepub fn set(&mut self, sec: &str, key: &str, value: &str) -> bool
pub fn set(&mut self, sec: &str, key: &str, value: &str) -> bool
add or replace (false: a bad name) [ini_set]