Fix deprecated warning in example

```
error: use of deprecated method `inotify::Inotify::add_watch`: use `Inotify.watches().add()` instead
  --> examples/linux-inotify.rs:38:27
   |
38 |         inotify.get_mut().add_watch(".", WatchMask::ALL_EVENTS)?;
   |                           ^^^^^^^^^
   |
   = note: `-D deprecated` implied by `-D warnings`
```
This commit is contained in:
Taiki Endo 2023-06-11 17:57:00 +09:00
parent b35cafc04b
commit 4604978cf0
1 changed files with 4 additions and 1 deletions

View File

@ -35,7 +35,10 @@ fn main() -> std::io::Result<()> {
smol::block_on(async {
// Watch events in the current directory.
let mut inotify = Async::new(Inotify::init()?)?;
inotify.get_mut().add_watch(".", WatchMask::ALL_EVENTS)?;
inotify
.get_mut()
.watches()
.add(".", WatchMask::ALL_EVENTS)?;
println!("Watching for filesystem events in the current directory...");
println!("Try opening a file to trigger some events.");
println!();