1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-09-14 19:16:17 +00:00

wc: adapt to API changes of uucore/pipes

This commit is contained in:
Daniel Hofstetter 2024-08-14 17:17:44 +02:00
parent 5342bae38d
commit 563e3cefd0
2 changed files with 4 additions and 4 deletions

View file

@ -19,7 +19,7 @@ use nix::sys::stat;
#[cfg(unix)]
use std::io::{Seek, SeekFrom};
#[cfg(any(target_os = "linux", target_os = "android"))]
use std::os::unix::io::AsRawFd;
use std::os::fd::{AsFd, AsRawFd};
#[cfg(windows)]
use std::os::windows::fs::MetadataExt;
#[cfg(windows)]
@ -43,7 +43,7 @@ const SPLICE_SIZE: usize = 128 * 1024;
/// caller will fall back to a simpler method.
#[inline]
#[cfg(any(target_os = "linux", target_os = "android"))]
fn count_bytes_using_splice(fd: &impl AsRawFd) -> Result<usize, usize> {
fn count_bytes_using_splice(fd: &impl AsFd) -> Result<usize, usize> {
let null_file = OpenOptions::new()
.write(true)
.open("/dev/null")

View file

@ -11,10 +11,10 @@ use std::fs::File;
use std::io::{BufRead, BufReader, Read, StdinLock};
#[cfg(unix)]
use std::os::unix::io::AsRawFd;
use std::os::fd::{AsFd, AsRawFd};
#[cfg(unix)]
pub trait WordCountable: AsRawFd + Read {
pub trait WordCountable: AsFd + AsRawFd + Read {
type Buffered: BufRead;
fn buffered(self) -> Self::Buffered;
fn inner_file(&mut self) -> Option<&mut File>;