Skip to content

Commit

Permalink
Use rustix in linux-timerfd example
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e committed Aug 29, 2023
1 parent 86dad66 commit 7e95fff
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
3 changes: 1 addition & 2 deletions examples/linux-timerfd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand All @@ -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(())
}
Expand Down

0 comments on commit 7e95fff

Please sign in to comment.