mirror of https://github.com/stjepang/smol
Bump all subcrates to their newest versions
This is a breaking change. Signed-off-by: John Nunley <dev@notgull.net>
This commit is contained in:
parent
f337143aba
commit
4cb1825107
|
@ -18,14 +18,14 @@ exclude = ["/.*"]
|
||||||
async-channel = "2.0.0"
|
async-channel = "2.0.0"
|
||||||
async-executor = "1.5.0"
|
async-executor = "1.5.0"
|
||||||
async-fs = "2.0.0"
|
async-fs = "2.0.0"
|
||||||
async-io = "1.12.0"
|
async-io = "2.1.0"
|
||||||
async-lock = "3.0.0"
|
async-lock = "3.0.0"
|
||||||
async-net = "2.0.0"
|
async-net = "2.0.0"
|
||||||
blocking = "1.3.0"
|
blocking = "1.3.0"
|
||||||
futures-lite = "1.11.0"
|
futures-lite = "2.0.0"
|
||||||
|
|
||||||
[target.'cfg(not(target_os = "espidf"))'.dependencies]
|
[target.'cfg(not(target_os = "espidf"))'.dependencies]
|
||||||
async-process = "1.6.0"
|
async-process = "2.0.0"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
anyhow = "1"
|
anyhow = "1"
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
fn main() -> std::io::Result<()> {
|
fn main() -> std::io::Result<()> {
|
||||||
use std::ffi::OsString;
|
use std::ffi::OsString;
|
||||||
|
use std::os::unix::io::AsFd;
|
||||||
|
|
||||||
use inotify::{EventMask, Inotify, WatchMask};
|
use inotify::{EventMask, Inotify, WatchMask};
|
||||||
use smol::{io, Async};
|
use smol::{io, Async};
|
||||||
|
@ -34,9 +35,9 @@ fn main() -> std::io::Result<()> {
|
||||||
|
|
||||||
smol::block_on(async {
|
smol::block_on(async {
|
||||||
// Watch events in the current directory.
|
// 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
|
inotify
|
||||||
.get_mut()
|
|
||||||
.watches()
|
.watches()
|
||||||
.add(".", WatchMask::ALL_EVENTS)?;
|
.add(".", WatchMask::ALL_EVENTS)?;
|
||||||
println!("Watching for filesystem events in the current directory...");
|
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.
|
// Wait for events in a loop and print them on the screen.
|
||||||
loop {
|
loop {
|
||||||
for event in inotify.read_with_mut(read_op).await? {
|
for event in source.read_with(|_| read_op(&mut inotify)).await? {
|
||||||
println!("{:?}", event);
|
println!("{:?}", event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue