Expand description
Monitors a directory for file changes and streams new content over a channel.
§Quick start
use watch_dir::{Watcher, Options};
use std::path::Path;
let mut watcher = Watcher::new(Path::new("/var/log"), Options::default())?;
let rx = watcher.take_receiver().unwrap();
for (path, content) in rx {
println!("{}: {}", path.display(), content);
}Structs§
- Options
- Configuration for a
Watcher. - Watch
DirError - Error type returned by this crate.
- Watcher
- Watches a directory for file changes and streams new content over a channel.
Enums§
- Error
Kind - The category of a
WatchDirError. - Read
Strategy - Controls how a file’s contents are read and emitted when it changes.
Constants§
- REPLACE_
STRATEGY - A
SelectStrategythat appliesReadStrategy::Replaceto all files. - TAIL_
LINES_ STRATEGY - A
SelectStrategythat appliesReadStrategy::TailLinesto all files. - TAIL_
STRATEGY - A
SelectStrategythat appliesReadStrategy::Tailto all files.
Traits§
- Select
Strategy - Determines the
ReadStrategyto apply to a file.