Skip to main content

Crate watch_dir

Crate watch_dir 

Source
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.
WatchDirError
Error type returned by this crate.
Watcher
Watches a directory for file changes and streams new content over a channel.

Enums§

ErrorKind
The category of a WatchDirError.
ReadStrategy
Controls how a file’s contents are read and emitted when it changes.

Constants§

REPLACE_STRATEGY
A SelectStrategy that applies ReadStrategy::Replace to all files.
TAIL_LINES_STRATEGY
A SelectStrategy that applies ReadStrategy::TailLines to all files.
TAIL_STRATEGY
A SelectStrategy that applies ReadStrategy::Tail to all files.

Traits§

SelectStrategy
Determines the ReadStrategy to apply to a file.