diff --git a/Cargo.toml b/Cargo.toml index 25f895b..5eebd20 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,14 +18,14 @@ exclude = ["/.*"] async-channel = "2.0.0" async-executor = "1.5.0" async-fs = "2.0.0" -async-io = "1.12.0" +async-io = "2.1.0" async-lock = "3.0.0" async-net = "2.0.0" blocking = "1.3.0" -futures-lite = "1.11.0" +futures-lite = "2.0.0" [target.'cfg(not(target_os = "espidf"))'.dependencies] -async-process = "1.6.0" +async-process = "2.0.0" [dev-dependencies] anyhow = "1" diff --git a/examples/linux-inotify.rs b/examples/linux-inotify.rs index 16cb4dd..abbb760 100644 --- a/examples/linux-inotify.rs +++ b/examples/linux-inotify.rs @@ -9,6 +9,7 @@ #[cfg(target_os = "linux")] fn main() -> std::io::Result<()> { use std::ffi::OsString; + use std::os::unix::io::AsFd; use inotify::{EventMask, Inotify, WatchMask}; use smol::{io, Async}; @@ -34,9 +35,9 @@ fn main() -> std::io::Result<()> { smol::block_on(async { // Watch events in the current directory. - let mut inotify = Async::new(Inotify::init()?)?; + let mut inotify = Inotify::init()?; + let source = Async::new(inotify.as_fd().try_clone_to_owned()?)?; inotify - .get_mut() .watches() .add(".", WatchMask::ALL_EVENTS)?; println!("Watching for filesystem events in the current directory..."); @@ -45,7 +46,7 @@ fn main() -> std::io::Result<()> { // Wait for events in a loop and print them on the screen. loop { - for event in inotify.read_with_mut(read_op).await? { + for event in source.read_with(|_| read_op(&mut inotify)).await? { println!("{:?}", event); } }