pub struct Settings { /* private fields */ }
Expand description
Settings state.
Implementations§
source§impl Settings
impl Settings
sourcepub fn load_file(&mut self) -> bool
pub fn load_file(&mut self) -> bool
Loads the settings from the settings file.
This will return false
if something fails.
sourcepub fn config_path(file: impl AsRef<Path>) -> Option<PathBuf>
pub fn config_path(file: impl AsRef<Path>) -> Option<PathBuf>
Returns the path to the config file.
sourcepub fn load_data<T>(&mut self, id: impl AsRef<str>) -> Option<T>where
T: DeserializeOwned,
pub fn load_data<T>(&mut self, id: impl AsRef<str>) -> Option<T>where
T: DeserializeOwned,
Loads data from the settings map.
sourcepub fn store_data(&mut self, id: impl Into<String>, data: impl Serialize)
pub fn store_data(&mut self, id: impl Into<String>, data: impl Serialize)
Stores data in the settings map.
Silently fails if the data fails serialization.
sourcepub fn load_component<T>(&mut self, component: &mut T)where
T: HasSettings,
pub fn load_component<T>(&mut self, component: &mut T)where
T: HasSettings,
Loads a component’s settings from the settings map.
sourcepub fn store_component<T>(&mut self, component: &T)where
T: HasSettings,
pub fn store_component<T>(&mut self, component: &T)where
T: HasSettings,
Stores a component’s settings in the settings map.
Silently fails if the component’s settings fail serialization.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Settings
impl RefUnwindSafe for Settings
impl Send for Settings
impl Sync for Settings
impl Unpin 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