pub struct Settings { /* private fields */ }Expand description
typed settings over a file (see the module header)
Implementations§
Source§impl Settings
impl Settings
Sourcepub fn open(path: &str, schema: &'static Schema) -> Settings
pub fn open(path: &str, schema: &'static Schema) -> Settings
the settings of a file (a missing or unreadable file: the defaults)
Sourcepub fn from_ini(ini: Ini, schema: &'static Schema) -> Settings
pub fn from_ini(ini: Ini, schema: &'static Schema) -> Settings
settings in memory, read from an Ini (migrated like a file)
pub fn schema(&self) -> &'static Schema
Sourcepub fn file_version(&self) -> u32
pub fn file_version(&self) -> u32
the format version the file had before a migration (0: none / no version line)
Sourcepub fn get<T: Value>(&self, k: &Key<T>) -> T
pub fn get<T: Value>(&self, k: &Key<T>) -> T
a value (the key’s default when the key is not in the schema and not in the file)
Sourcepub fn set<T: Value>(&mut self, k: &Key<T>, v: T) -> bool
pub fn set<T: Value>(&mut self, k: &Key<T>, v: T) -> bool
set a value (made valid for the key) -> the value or the file changed (the default removes every line of the key, also one that held it already)
Sourcepub fn reset<T>(&mut self, k: &Key<T>) -> bool
pub fn reset<T>(&mut self, k: &Key<T>) -> bool
back to the default: every line of the key leaves the file (also an explicit default, a value that read as the default, a second line of the same key)
Sourcepub fn is_default<T>(&self, k: &Key<T>) -> bool
pub fn is_default<T>(&self, k: &Key<T>) -> bool
the key has its default value
Sourcepub fn default_at(&self, i: usize) -> Val
pub fn default_at(&self, i: usize) -> Val
the default of schema key i
Sourcepub fn set_at(&mut self, i: usize, v: Val) -> bool
pub fn set_at(&mut self, i: usize, v: Val) -> bool
set schema key i (made valid) -> the value or the file changed (as set)
Sourcepub fn revision(&self) -> u32
pub fn revision(&self) -> u32
counts every change (redraw or apply what depends on the settings when it moved)