pub struct HotReloadConfig { /* private fields */ }Expand description
Hot-reloading configuration manager
Implementations§
Source§impl HotReloadConfig
impl HotReloadConfig
Sourcepub fn new<P: AsRef<Path>>(
file_path: P,
check_interval: Duration,
) -> Result<Self, UtilsError>
pub fn new<P: AsRef<Path>>( file_path: P, check_interval: Duration, ) -> Result<Self, UtilsError>
Create a new hot-reload configuration manager
Sourcepub fn get_config(&self) -> Arc<RwLock<Config>>
pub fn get_config(&self) -> Arc<RwLock<Config>>
Get the current configuration
Sourcepub fn check_and_reload(&mut self) -> Result<bool, UtilsError>
pub fn check_and_reload(&mut self) -> Result<bool, UtilsError>
Check for file updates and reload if necessary
Sourcepub fn start_auto_reload(self) -> JoinHandle<()>
pub fn start_auto_reload(self) -> JoinHandle<()>
Start automatic reloading in a background thread
Auto Trait Implementations§
impl Freeze for HotReloadConfig
impl RefUnwindSafe for HotReloadConfig
impl Send for HotReloadConfig
impl Sync for HotReloadConfig
impl Unpin for HotReloadConfig
impl UnwindSafe for HotReloadConfig
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