-
Notifications
You must be signed in to change notification settings - Fork 202
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move examples and add smoke test for readme
- Loading branch information
Showing
5 changed files
with
27 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
use notify::{RecommendedWatcher, RecursiveMode, Watcher}; | ||
use std::path::Path; | ||
|
||
fn main() -> notify::Result<()> { | ||
let (tx, rx) = std::sync::mpsc::channel(); | ||
|
||
// Automatically select the best implementation for your platform. | ||
// You can also access each implementation directly e.g. INotifyWatcher. | ||
// Note that dropping this `watcher` will exit the Watcher-Loop itself. | ||
let mut watcher = RecommendedWatcher::new(tx)?; | ||
|
||
// Add a path to be watched. All files and directories at that path and | ||
// below will be monitored for changes. | ||
watcher.watch(Path::new("."), RecursiveMode::Recursive)?; | ||
|
||
for res in rx { | ||
match res { | ||
Ok(event) => println!("changed: {:?}", event), | ||
Err(e) => println!("watch error: {:?}", e), | ||
} | ||
} | ||
|
||
Ok(()) | ||
} |