pub struct ConfigManager {
pub dirty: bool,
/* private fields */
}Expand description
Watches config.toml for changes via periodic timestamp polling.
Call ConfigManager::poll once per frame in the main loop. When the
file has been modified externally dirty is set to true and the new
config is available via ConfigManager::config.
Fields§
§dirty: boolSet to true by poll when the file changed.
Implementations§
Source§impl ConfigManager
impl ConfigManager
Sourcepub fn new(dir: PathBuf) -> Self
pub fn new(dir: PathBuf) -> Self
Create a new manager, immediately loading the config from dir.
pub fn config(&self) -> &Config
Sourcepub fn error(&self) -> Option<&str>
pub fn error(&self) -> Option<&str>
Error message from the last failed config load/parse, if any.
Sourcepub fn save_theme(&mut self, theme_name: &str)
pub fn save_theme(&mut self, theme_name: &str)
Update the theme field and immediately persist.
When selecting a built-in theme, custom overrides are cleared so they
don’t leak into the newly chosen theme.
Sourcepub fn save_custom_theme(&mut self, colors: CustomThemeColors)
pub fn save_custom_theme(&mut self, colors: CustomThemeColors)
Set custom theme colour overrides in config and persist.
pub fn tick_rate(&self) -> Duration
pub fn set_tick_rate(&mut self, duration: Duration)
Sourcepub fn clear_custom_theme(&mut self)
pub fn clear_custom_theme(&mut self)
Remove custom theme colour overrides from config and persist.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ConfigManager
impl RefUnwindSafe for ConfigManager
impl Send for ConfigManager
impl Sync for ConfigManager
impl Unpin for ConfigManager
impl UnsafeUnpin for ConfigManager
impl UnwindSafe for ConfigManager
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more