All tests run on an 8-year-old MacBook Air.
Drop a PDF into a folder. By the time you look at your screen, it's already been processed.
That's the Hot Folder feature — and it's powered by notify , a cross-platform file system watcher for Rust.
Basic setup
use notify ::{ Config , Event , RecommendedWatcher , RecursiveMode , Watcher }; use std :: path :: Path ; use std :: sync :: mpsc ;
pub fn watch_folder ( folder : & Path , tx : mpsc :: Sender > , ) -> notify :: Result { let mut watcher = RecommendedWatcher :: new ( move | res | { tx .send ( res ) .unwrap (); }, Config :: default (), ) ? ;
watcher .watch ( folder , RecursiveMode :: NonRecursive ) ? ; Ok ( watcher ) }
Enter fullscreen mode
Exit fullscreen mode
RecommendedWatcher uses FSEvents on macOS — low overhead, near-instant detection.
Handling events
Not every event should trigger the pipeline.…