pub struct FileWatcher { /* private fields */ }Expand description
File watcher for monitoring configuration file changes
Monitors configuration directories for file modifications and triggers configuration reloads when changes are detected. Includes debouncing to avoid excessive reloads during rapid file changes.
Implementations§
Source§impl FileWatcher
impl FileWatcher
Sourcepub fn new(loader: Arc<ConfigurationLoader>, paths: Vec<PathBuf>) -> Self
pub fn new(loader: Arc<ConfigurationLoader>, paths: Vec<PathBuf>) -> Self
Create a new file watcher
§Arguments
loader- The configuration loader to use for reloadingpaths- Directories to monitor for changesdebounce_ms- Debounce delay in milliseconds (default: 500ms)
Sourcepub fn with_debounce(
loader: Arc<ConfigurationLoader>,
paths: Vec<PathBuf>,
debounce_ms: u64,
) -> Self
pub fn with_debounce( loader: Arc<ConfigurationLoader>, paths: Vec<PathBuf>, debounce_ms: u64, ) -> Self
Create a new file watcher with custom debounce delay
Sourcepub async fn watch(&self) -> MarkdownConfigResult<()>
pub async fn watch(&self) -> MarkdownConfigResult<()>
Start watching configuration directories for changes
This method runs indefinitely, monitoring for file changes and triggering reloads when detected. It should be run in a separate task.
Sourcepub async fn is_watching(&self) -> bool
pub async fn is_watching(&self) -> bool
Check if watcher is currently watching
Auto Trait Implementations§
impl Freeze for FileWatcher
impl !RefUnwindSafe for FileWatcher
impl Send for FileWatcher
impl Sync for FileWatcher
impl Unpin for FileWatcher
impl !UnwindSafe for FileWatcher
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