pub struct FileWatcher { /* private fields */ }Expand description
Main file watcher that can watch directories for changes
Implementations§
Source§impl FileWatcher
impl FileWatcher
Sourcepub fn new<F>(watch_dir: PathBuf, filter: F) -> Selfwhere
F: FileFilter + 'static,
pub fn new<F>(watch_dir: PathBuf, filter: F) -> Selfwhere
F: FileFilter + 'static,
Create a new file watcher
Sourcepub fn initialize(&mut self) -> Result<(), String>
pub fn initialize(&mut self) -> Result<(), String>
Initialize the watcher and scan for existing files
Sourcepub async fn start_watching(
&mut self,
) -> Result<Receiver<FileWatchEvent>, String>
pub async fn start_watching( &mut self, ) -> Result<Receiver<FileWatchEvent>, String>
Start watching the directory and return a receiver for processed events
Sourcepub fn get_watched_files(&self) -> &HashMap<String, FileBuffer>
pub fn get_watched_files(&self) -> &HashMap<String, FileBuffer>
Get current watched files (snapshot at initialization)
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
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>
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