Skip to content

Commit c784046

Browse files
oech3cakebaker
authored andcommitted
od: generalize RawReader
1 parent 9bf907d commit c784046

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/uu/od/src/multifile_reader.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,12 @@ impl MultifileReader<'_> {
5656
// limit.
5757
#[cfg(any(unix, target_os = "wasi"))]
5858
{
59-
struct RawReader<'a>(rustix::fd::BorrowedFd<'a>);
60-
impl io::Read for RawReader<'_> {
59+
use std::os::fd::AsFd;
60+
// todo: definition is generic enough to move to uucore::io::RawReader if useful
61+
struct RawReader<T: AsFd>(pub T);
62+
impl<T: AsFd> io::Read for RawReader<T> {
6163
fn read(&mut self, b: &mut [u8]) -> io::Result<usize> {
62-
rustix::io::read(self.0, b).map_err(Into::into)
64+
rustix::io::read(&self.0, b).map_err(Into::into)
6365
}
6466
}
6567
let stdin = RawReader(rustix::stdio::stdin());

0 commit comments

Comments
 (0)