Expand description
Filesystem watcher for automatic file tracking and sync.
This module provides a filesystem watcher that:
- Detects new files and auto-tracks them (unless ignored)
- Detects modifications to tracked files and refreshes them
- Batches changes and optionally syncs with peers
§Example
ⓘ
use darn_core::watcher::{Watcher, WatcherConfig, WatchEvent};
let config = WatcherConfig::default();
let (watcher, mut rx) = Watcher::new(&darn, config)?;
while let Some(event) = rx.recv().await {
match event {
WatchEvent::FileCreated(path) => println!("New: {}", path.display()),
WatchEvent::FileModified(path) => println!("Modified: {}", path.display()),
WatchEvent::FileDeleted(path) => println!("Deleted: {}", path.display()),
WatchEvent::Error(e) => eprintln!("Error: {e}"),
}
}Structs§
- Watch
Batch - A batch of filesystem changes ready for processing.
- Watch
Event Processor - Processes watch events and batches them for efficient handling.
- Watch
Process Result - Result of processing a batch of watch events.
- Watcher
- Filesystem watcher for a darn workspace.
- Watcher
Config - Configuration for the filesystem watcher.
Enums§
- Watch
Event - Events emitted by the watcher.
- Watcher
Error - Errors from the watcher.