pub struct AresConfigManager { /* private fields */ }Expand description
Thread-safe configuration manager with hot reloading support
Implementations§
Source§impl AresConfigManager
impl AresConfigManager
Sourcepub fn new<P: AsRef<Path>>(path: P) -> Result<Self, ConfigError>
pub fn new<P: AsRef<Path>>(path: P) -> Result<Self, ConfigError>
Create a new configuration manager and load the initial config
§Panics
Panics if ares.toml doesn’t exist or is invalid.
Sourcepub fn config(&self) -> Arc<AresConfig> ⓘ
pub fn config(&self) -> Arc<AresConfig> ⓘ
Get the current configuration (lockless read)
Sourcepub fn reload(&self) -> Result<(), ConfigError>
pub fn reload(&self) -> Result<(), ConfigError>
Manually reload the configuration from disk
Sourcepub fn start_watching(&mut self) -> Result<(), ConfigError>
pub fn start_watching(&mut self) -> Result<(), ConfigError>
Start watching for configuration file changes.
Overlay is the only ares.toml program. This forwards to
Self::watch_cordis when a context is already captured and does
not start a second notify watcher stack.
Sourcepub fn stop_watching(&self)
pub fn stop_watching(&self)
Stop watching for configuration changes
Source§impl AresConfigManager
impl AresConfigManager
Sourcepub fn from_config(config: AresConfig) -> Self
pub fn from_config(config: AresConfig) -> Self
Create a config manager directly from a config (useful for testing) This won’t have file watching capabilities.
Source§impl AresConfigManager
impl AresConfigManager
Sourcepub fn watch_cordis(&self, ctx: &Arc<Context>) -> Result<(), ConfigError>
pub fn watch_cordis(&self, ctx: &Arc<Context>) -> Result<(), ConfigError>
Single Cordis watch for ares.toml plus TOON dirs.
Uses watch_many_with (no second notify stack). ares.toml changes
reload this overlay and notify TypeId::of::<Overlay>(); TOON changes
reload crate::toon_config::DynamicConfigManager and notify Tools
and Execute TypeIds.
Sourcepub fn fill_empty_entry_configs(&self, tree: &mut EntryTree)
pub fn fill_empty_entry_configs(&self, tree: &mut EntryTree)
Fill empty cordis-entry configs from ares.toml sections.
Non-empty loader entry.config values are left unchanged.
Trait Implementations§
Source§impl Clone for AresConfigManager
impl Clone for AresConfigManager
Auto Trait Implementations§
impl !Freeze for AresConfigManager
impl !RefUnwindSafe for AresConfigManager
impl !UnwindSafe for AresConfigManager
impl Send for AresConfigManager
impl Sync for AresConfigManager
impl Unpin for AresConfigManager
impl UnsafeUnpin for AresConfigManager
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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> ⓘ
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> ⓘ
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