1616#![ deny( unsafe_op_in_unsafe_fn) ]
1717#![ allow( missing_docs, nonstandard_style) ]
1818
19- use crate :: io:: ErrorKind ;
19+ use crate :: io;
2020use crate :: os:: hermit:: hermit_abi;
2121use crate :: os:: raw:: c_char;
2222use crate :: sys:: env;
@@ -27,15 +27,12 @@ pub mod os;
2727pub mod pipe;
2828pub mod time;
2929
30- pub fn unsupported < T > ( ) -> crate :: io:: Result < T > {
30+ pub fn unsupported < T > ( ) -> io:: Result < T > {
3131 Err ( unsupported_err ( ) )
3232}
3333
34- pub fn unsupported_err ( ) -> crate :: io:: Error {
35- crate :: io:: const_error!(
36- crate :: io:: ErrorKind :: Unsupported ,
37- "operation not supported on HermitCore yet" ,
38- )
34+ pub fn unsupported_err ( ) -> io:: Error {
35+ io:: const_error!( io:: ErrorKind :: Unsupported , "operation not supported on HermitCore yet" )
3936}
4037
4138pub fn abort_internal ( ) -> ! {
@@ -85,24 +82,24 @@ pub(crate) fn is_interrupted(errno: i32) -> bool {
8582 errno == hermit_abi:: errno:: EINTR
8683}
8784
88- pub fn decode_error_kind ( errno : i32 ) -> ErrorKind {
85+ pub fn decode_error_kind ( errno : i32 ) -> io :: ErrorKind {
8986 match errno {
90- hermit_abi:: errno:: EACCES => ErrorKind :: PermissionDenied ,
91- hermit_abi:: errno:: EADDRINUSE => ErrorKind :: AddrInUse ,
92- hermit_abi:: errno:: EADDRNOTAVAIL => ErrorKind :: AddrNotAvailable ,
93- hermit_abi:: errno:: EAGAIN => ErrorKind :: WouldBlock ,
94- hermit_abi:: errno:: ECONNABORTED => ErrorKind :: ConnectionAborted ,
95- hermit_abi:: errno:: ECONNREFUSED => ErrorKind :: ConnectionRefused ,
96- hermit_abi:: errno:: ECONNRESET => ErrorKind :: ConnectionReset ,
97- hermit_abi:: errno:: EEXIST => ErrorKind :: AlreadyExists ,
98- hermit_abi:: errno:: EINTR => ErrorKind :: Interrupted ,
99- hermit_abi:: errno:: EINVAL => ErrorKind :: InvalidInput ,
100- hermit_abi:: errno:: ENOENT => ErrorKind :: NotFound ,
101- hermit_abi:: errno:: ENOTCONN => ErrorKind :: NotConnected ,
102- hermit_abi:: errno:: EPERM => ErrorKind :: PermissionDenied ,
103- hermit_abi:: errno:: EPIPE => ErrorKind :: BrokenPipe ,
104- hermit_abi:: errno:: ETIMEDOUT => ErrorKind :: TimedOut ,
105- _ => ErrorKind :: Uncategorized ,
87+ hermit_abi:: errno:: EACCES => io :: ErrorKind :: PermissionDenied ,
88+ hermit_abi:: errno:: EADDRINUSE => io :: ErrorKind :: AddrInUse ,
89+ hermit_abi:: errno:: EADDRNOTAVAIL => io :: ErrorKind :: AddrNotAvailable ,
90+ hermit_abi:: errno:: EAGAIN => io :: ErrorKind :: WouldBlock ,
91+ hermit_abi:: errno:: ECONNABORTED => io :: ErrorKind :: ConnectionAborted ,
92+ hermit_abi:: errno:: ECONNREFUSED => io :: ErrorKind :: ConnectionRefused ,
93+ hermit_abi:: errno:: ECONNRESET => io :: ErrorKind :: ConnectionReset ,
94+ hermit_abi:: errno:: EEXIST => io :: ErrorKind :: AlreadyExists ,
95+ hermit_abi:: errno:: EINTR => io :: ErrorKind :: Interrupted ,
96+ hermit_abi:: errno:: EINVAL => io :: ErrorKind :: InvalidInput ,
97+ hermit_abi:: errno:: ENOENT => io :: ErrorKind :: NotFound ,
98+ hermit_abi:: errno:: ENOTCONN => io :: ErrorKind :: NotConnected ,
99+ hermit_abi:: errno:: EPERM => io :: ErrorKind :: PermissionDenied ,
100+ hermit_abi:: errno:: EPIPE => io :: ErrorKind :: BrokenPipe ,
101+ hermit_abi:: errno:: ETIMEDOUT => io :: ErrorKind :: TimedOut ,
102+ _ => io :: ErrorKind :: Uncategorized ,
106103 }
107104}
108105
@@ -135,16 +132,16 @@ impl IsNegative for i32 {
135132}
136133impl_is_negative ! { i8 i16 i64 isize }
137134
138- pub fn cvt < T : IsNegative > ( t : T ) -> crate :: io:: Result < T > {
135+ pub fn cvt < T : IsNegative > ( t : T ) -> io:: Result < T > {
139136 if t. is_negative ( ) {
140137 let e = decode_error_kind ( t. negate ( ) ) ;
141- Err ( crate :: io:: Error :: from ( e) )
138+ Err ( io:: Error :: from ( e) )
142139 } else {
143140 Ok ( t)
144141 }
145142}
146143
147- pub fn cvt_r < T , F > ( mut f : F ) -> crate :: io:: Result < T >
144+ pub fn cvt_r < T , F > ( mut f : F ) -> io:: Result < T >
148145where
149146 T : IsNegative ,
150147 F : FnMut ( ) -> T ,
0 commit comments