2
2
3
3
use super :: hermit_abi;
4
4
use crate :: cmp;
5
- use crate :: io:: { self , IoSlice , IoSliceMut , Read } ;
5
+ use crate :: io:: { self , IoSlice , IoSliceMut } ;
6
6
use crate :: os:: hermit:: io:: { FromRawFd , OwnedFd , RawFd , * } ;
7
- use crate :: sys:: { cvt, unsupported } ;
7
+ use crate :: sys:: cvt;
8
8
use crate :: sys_common:: { AsInner , FromInner , IntoInner } ;
9
9
10
10
const fn max_iov ( ) -> usize {
@@ -39,11 +39,6 @@ impl FileDesc {
39
39
true
40
40
}
41
41
42
- pub fn read_to_end ( & self , buf : & mut Vec < u8 > ) -> io:: Result < usize > {
43
- let mut me = self ;
44
- ( & mut me) . read_to_end ( buf)
45
- }
46
-
47
42
pub fn write ( & self , buf : & [ u8 ] ) -> io:: Result < usize > {
48
43
let result =
49
44
cvt ( unsafe { hermit_abi:: write ( self . fd . as_raw_fd ( ) , buf. as_ptr ( ) , buf. len ( ) ) } ) ?;
@@ -66,37 +61,12 @@ impl FileDesc {
66
61
true
67
62
}
68
63
69
- pub fn duplicate ( & self ) -> io:: Result < FileDesc > {
70
- self . duplicate_path ( & [ ] )
71
- }
72
- pub fn duplicate_path ( & self , _path : & [ u8 ] ) -> io:: Result < FileDesc > {
73
- unsupported ( )
74
- }
75
-
76
- pub fn nonblocking ( & self ) -> io:: Result < bool > {
77
- Ok ( false )
78
- }
79
-
80
- pub fn set_cloexec ( & self ) -> io:: Result < ( ) > {
81
- unsupported ( )
82
- }
83
-
84
- pub fn set_nonblocking ( & self , _nonblocking : bool ) -> io:: Result < ( ) > {
85
- unsupported ( )
86
- }
87
-
88
64
pub fn fstat ( & self , stat : * mut hermit_abi:: stat ) -> io:: Result < ( ) > {
89
65
cvt ( unsafe { hermit_abi:: fstat ( self . fd . as_raw_fd ( ) , stat) } ) ?;
90
66
Ok ( ( ) )
91
67
}
92
68
}
93
69
94
- impl < ' a > Read for & ' a FileDesc {
95
- fn read ( & mut self , buf : & mut [ u8 ] ) -> io:: Result < usize > {
96
- ( * * self ) . read ( buf)
97
- }
98
- }
99
-
100
70
impl IntoInner < OwnedFd > for FileDesc {
101
71
fn into_inner ( self ) -> OwnedFd {
102
72
self . fd
0 commit comments