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) -> it changed
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 revision(&self) -> u32
pub fn revision(&self) -> u32
counts every change (redraw or apply what depends on the settings when it moved)
Auto Trait Implementations§
impl Forget for Settings
impl Freeze for Settings
impl RefUnwindSafe for Settings
impl Send for Settings
impl Sync for Settings
impl Unpin for Settings
impl UnsafeUnpin for Settings
impl UnwindSafe for Settings
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more