@@ -133,29 +133,31 @@ pub use crate::sys::android::signal;
133
133
pub use libc:: signal;
134
134
135
135
pub fn decode_error_kind ( errno : i32 ) -> ErrorKind {
136
+ use ErrorKind :: * ;
136
137
match errno as libc:: c_int {
137
- libc:: ECONNREFUSED => ErrorKind :: ConnectionRefused ,
138
- libc:: ECONNRESET => ErrorKind :: ConnectionReset ,
139
- libc:: EPERM | libc:: EACCES => ErrorKind :: PermissionDenied ,
140
- libc:: EPIPE => ErrorKind :: BrokenPipe ,
141
- libc:: ENOTCONN => ErrorKind :: NotConnected ,
142
- libc:: ECONNABORTED => ErrorKind :: ConnectionAborted ,
143
- libc:: EADDRNOTAVAIL => ErrorKind :: AddrNotAvailable ,
144
- libc:: EADDRINUSE => ErrorKind :: AddrInUse ,
145
- libc:: ENOENT => ErrorKind :: NotFound ,
146
- libc:: EINTR => ErrorKind :: Interrupted ,
147
- libc:: EINVAL => ErrorKind :: InvalidInput ,
148
- libc:: ETIMEDOUT => ErrorKind :: TimedOut ,
149
- libc:: EEXIST => ErrorKind :: AlreadyExists ,
150
- libc:: ENOSYS => ErrorKind :: Unsupported ,
151
- libc:: ENOMEM => ErrorKind :: OutOfMemory ,
138
+ libc:: EADDRINUSE => AddrInUse ,
139
+ libc:: EADDRNOTAVAIL => AddrNotAvailable ,
140
+ libc:: ECONNABORTED => ConnectionAborted ,
141
+ libc:: ECONNREFUSED => ConnectionRefused ,
142
+ libc:: ECONNRESET => ConnectionReset ,
143
+ libc:: EEXIST => AlreadyExists ,
144
+ libc:: EINTR => Interrupted ,
145
+ libc:: EINVAL => InvalidInput ,
146
+ libc:: ENOENT => NotFound ,
147
+ libc:: ENOMEM => OutOfMemory ,
148
+ libc:: ENOSYS => Unsupported ,
149
+ libc:: ENOTCONN => NotConnected ,
150
+ libc:: EPIPE => BrokenPipe ,
151
+ libc:: ETIMEDOUT => TimedOut ,
152
+
153
+ libc:: EACCES | libc:: EPERM => PermissionDenied ,
152
154
153
155
// These two constants can have the same value on some systems,
154
156
// but different values on others, so we can't use a match
155
157
// clause
156
- x if x == libc:: EAGAIN || x == libc:: EWOULDBLOCK => ErrorKind :: WouldBlock ,
158
+ x if x == libc:: EAGAIN || x == libc:: EWOULDBLOCK => WouldBlock ,
157
159
158
- _ => ErrorKind :: Uncategorized ,
160
+ _ => Uncategorized ,
159
161
}
160
162
}
161
163
0 commit comments