File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ byteorder = { workspace = true }
2222clap = { workspace = true }
2323half = { workspace = true }
2424rustix = { workspace = true , features = [" stdio" ] }
25- uucore = { workspace = true , features = [" parser-size" ] }
25+ uucore = { workspace = true , features = [" fs " , " parser-size" ] }
2626fluent = { workspace = true }
2727libc.workspace = true
2828
Original file line number Diff line number Diff line change @@ -56,15 +56,7 @@ impl MultifileReader<'_> {
5656 // limit.
5757 #[ cfg( any( unix, target_os = "wasi" ) ) ]
5858 {
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 > {
63- fn read ( & mut self , b : & mut [ u8 ] ) -> io:: Result < usize > {
64- rustix:: io:: read ( & self . 0 , b) . map_err ( Into :: into)
65- }
66- }
67- let stdin = RawReader ( rustix:: stdio:: stdin ( ) ) ;
59+ let stdin = uucore:: io:: RawReader ( rustix:: stdio:: stdin ( ) ) ;
6860 self . curr_file = Some ( Box :: new ( stdin) ) ;
6961 }
7062
Original file line number Diff line number Diff line change @@ -30,6 +30,16 @@ type NativeType = OwnedHandle;
3030#[ cfg( not( windows) ) ]
3131type NativeType = OwnedFd ;
3232
33+ // create reader without buffering
34+ #[ cfg( any( unix, target_os = "wasi" ) ) ]
35+ pub struct RawReader < T : AsFd > ( pub T ) ;
36+ #[ cfg( any( unix, target_os = "wasi" ) ) ]
37+ impl < T : AsFd > io:: Read for RawReader < T > {
38+ fn read ( & mut self , b : & mut [ u8 ] ) -> io:: Result < usize > {
39+ rustix:: io:: read ( & self . 0 , b) . map_err ( Into :: into)
40+ }
41+ }
42+
3343// create writer without buffering
3444#[ cfg( any( unix, target_os = "wasi" ) ) ]
3545pub struct RawWriter < T : AsFd > ( pub T ) ;
You can’t perform that action at this time.
0 commit comments