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;
@@ -25,15 +25,12 @@ pub mod futex;
2525pub mod os;
2626pub mod time;
2727
28- pub fn unsupported < T > ( ) -> crate :: io:: Result < T > {
28+ pub fn unsupported < T > ( ) -> io:: Result < T > {
2929 Err ( unsupported_err ( ) )
3030}
3131
32- pub fn unsupported_err ( ) -> crate :: io:: Error {
33- crate :: io:: const_error!(
34- crate :: io:: ErrorKind :: Unsupported ,
35- "operation not supported on HermitCore yet" ,
36- )
32+ pub fn unsupported_err ( ) -> io:: Error {
33+ io:: const_error!( io:: ErrorKind :: Unsupported , "operation not supported on HermitCore yet" )
3734}
3835
3936pub fn abort_internal ( ) -> ! {
@@ -83,24 +80,24 @@ pub(crate) fn is_interrupted(errno: i32) -> bool {
8380 errno == hermit_abi:: errno:: EINTR
8481}
8582
86- pub fn decode_error_kind ( errno : i32 ) -> ErrorKind {
83+ pub fn decode_error_kind ( errno : i32 ) -> io :: ErrorKind {
8784 match errno {
88- hermit_abi:: errno:: EACCES => ErrorKind :: PermissionDenied ,
89- hermit_abi:: errno:: EADDRINUSE => ErrorKind :: AddrInUse ,
90- hermit_abi:: errno:: EADDRNOTAVAIL => ErrorKind :: AddrNotAvailable ,
91- hermit_abi:: errno:: EAGAIN => ErrorKind :: WouldBlock ,
92- hermit_abi:: errno:: ECONNABORTED => ErrorKind :: ConnectionAborted ,
93- hermit_abi:: errno:: ECONNREFUSED => ErrorKind :: ConnectionRefused ,
94- hermit_abi:: errno:: ECONNRESET => ErrorKind :: ConnectionReset ,
95- hermit_abi:: errno:: EEXIST => ErrorKind :: AlreadyExists ,
96- hermit_abi:: errno:: EINTR => ErrorKind :: Interrupted ,
97- hermit_abi:: errno:: EINVAL => ErrorKind :: InvalidInput ,
98- hermit_abi:: errno:: ENOENT => ErrorKind :: NotFound ,
99- hermit_abi:: errno:: ENOTCONN => ErrorKind :: NotConnected ,
100- hermit_abi:: errno:: EPERM => ErrorKind :: PermissionDenied ,
101- hermit_abi:: errno:: EPIPE => ErrorKind :: BrokenPipe ,
102- hermit_abi:: errno:: ETIMEDOUT => ErrorKind :: TimedOut ,
103- _ => ErrorKind :: Uncategorized ,
85+ hermit_abi:: errno:: EACCES => io :: ErrorKind :: PermissionDenied ,
86+ hermit_abi:: errno:: EADDRINUSE => io :: ErrorKind :: AddrInUse ,
87+ hermit_abi:: errno:: EADDRNOTAVAIL => io :: ErrorKind :: AddrNotAvailable ,
88+ hermit_abi:: errno:: EAGAIN => io :: ErrorKind :: WouldBlock ,
89+ hermit_abi:: errno:: ECONNABORTED => io :: ErrorKind :: ConnectionAborted ,
90+ hermit_abi:: errno:: ECONNREFUSED => io :: ErrorKind :: ConnectionRefused ,
91+ hermit_abi:: errno:: ECONNRESET => io :: ErrorKind :: ConnectionReset ,
92+ hermit_abi:: errno:: EEXIST => io :: ErrorKind :: AlreadyExists ,
93+ hermit_abi:: errno:: EINTR => io :: ErrorKind :: Interrupted ,
94+ hermit_abi:: errno:: EINVAL => io :: ErrorKind :: InvalidInput ,
95+ hermit_abi:: errno:: ENOENT => io :: ErrorKind :: NotFound ,
96+ hermit_abi:: errno:: ENOTCONN => io :: ErrorKind :: NotConnected ,
97+ hermit_abi:: errno:: EPERM => io :: ErrorKind :: PermissionDenied ,
98+ hermit_abi:: errno:: EPIPE => io :: ErrorKind :: BrokenPipe ,
99+ hermit_abi:: errno:: ETIMEDOUT => io :: ErrorKind :: TimedOut ,
100+ _ => io :: ErrorKind :: Uncategorized ,
104101 }
105102}
106103
@@ -133,16 +130,16 @@ impl IsNegative for i32 {
133130}
134131impl_is_negative ! { i8 i16 i64 isize }
135132
136- pub fn cvt < T : IsNegative > ( t : T ) -> crate :: io:: Result < T > {
133+ pub fn cvt < T : IsNegative > ( t : T ) -> io:: Result < T > {
137134 if t. is_negative ( ) {
138135 let e = decode_error_kind ( t. negate ( ) ) ;
139- Err ( crate :: io:: Error :: from ( e) )
136+ Err ( io:: Error :: from ( e) )
140137 } else {
141138 Ok ( t)
142139 }
143140}
144141
145- pub fn cvt_r < T , F > ( mut f : F ) -> crate :: io:: Result < T >
142+ pub fn cvt_r < T , F > ( mut f : F ) -> io:: Result < T >
146143where
147144 T : IsNegative ,
148145 F : FnMut ( ) -> T ,
0 commit comments