-
Notifications
You must be signed in to change notification settings - Fork 229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
watcher
not available for import
#393
Comments
on further investigation, it looks like many of the examples in the docs are incorrect or broken. Here's a working basic example: use std::path::Path;
use std::time::Duration;
use std::thread;
use notify::{RecommendedWatcher, RecursiveMode, Result, recommended_watcher, Watcher};
fn main() -> Result<()> {
// Automatically select the best implementation for your platform.
let mut watcher: RecommendedWatcher = recommended_watcher(|res| {
match res {
Ok(event) => println!("event: {:?}", event),
Err(e) => println!("watch error: {:?}", e),
}
})?;
// 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)?;
thread::sleep(Duration::from_secs(10));
Ok(())
} |
Does "the docs" mean https://github.com/notify-rs/notify#usage? As stated at the beginning, you should refer to the docs.rs/notify if you want to get a working example. |
Thanks for the reply. To be honest, there's a number of things that I found confusing when trying to move from 4 to 5:
Sorry to sound negative. This package is great, I really appreciate it and all the hard work - I know how hard developing and document OS software can be. |
There is a tag for Edit: Direct readme link to the tag is fixed now. |
Thanks, sorry I missed that. At least it should make fixing the link very easy. |
System details
rustc --version
:rustc 1.61.0-nightly (285fa7ecd 2022-03-14)
5.0.0-pre.14
I'm trying to use the examples from the docs for version
5.0.0-pre.14
(or any v5 version), but I'm getting the following error:Not entirely clear what I'm doing wrong here, the code is taken directly from the docs/examples.
This can be replicated with the example direct from the docs:
The text was updated successfully, but these errors were encountered: