From 7e95fff0bf859d448ff436f138f0a808652a3b47 Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Wed, 30 Aug 2023 01:47:25 +0900 Subject: [PATCH] Use rustix in linux-timerfd example --- Cargo.toml | 2 +- examples/linux-timerfd.rs | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 3071c68..7d61fe5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -49,7 +49,7 @@ url = "2" [target.'cfg(target_os = "linux")'.dev-dependencies] inotify = { version = "0.10", default-features = false } -nix = "0.27" +rustix = "0.38" timerfd = "1" [target.'cfg(windows)'.dev-dependencies] diff --git a/examples/linux-timerfd.rs b/examples/linux-timerfd.rs index 888c5f3..304e6dd 100644 --- a/examples/linux-timerfd.rs +++ b/examples/linux-timerfd.rs @@ -8,7 +8,6 @@ #[cfg(target_os = "linux")] fn main() -> std::io::Result<()> { - use std::os::unix::io::AsRawFd; use std::time::{Duration, Instant}; use smol::{io, Async}; @@ -22,7 +21,7 @@ fn main() -> std::io::Result<()> { // When the OS timer fires, a 64-bit integer can be read from it. Async::new(timer)? - .read_with(|t| nix::unistd::read(t.as_raw_fd(), &mut [0u8; 8]).map_err(io::Error::from)) + .read_with(|t| rustix::io::read(t, &mut [0u8; 8]).map_err(io::Error::from)) .await?; Ok(()) }