pub struct ConfigWatcher { /* private fields */ }Expand description
Active file watcher. Drop to stop.
Implementations§
Source§impl ConfigWatcher
impl ConfigWatcher
Sourcepub fn spawn<F>(path: impl AsRef<Path>, on_change: F) -> Result<Self, Error>
pub fn spawn<F>(path: impl AsRef<Path>, on_change: F) -> Result<Self, Error>
Watch path for changes; on each debounced event, reload the
file and invoke on_change with the parsed result. Errors from
the loader are passed to on_change as Err so callers can
emit ObsConfigReloadFailed self-events without their own
retry loop.
§Errors
Returns the underlying notify error if the watcher cannot be installed (e.g. path does not exist, EMFILE, permission).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ConfigWatcher
impl !RefUnwindSafe for ConfigWatcher
impl Send for ConfigWatcher
impl Sync for ConfigWatcher
impl Unpin for ConfigWatcher
impl UnsafeUnpin for ConfigWatcher
impl !UnwindSafe for ConfigWatcher
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