1 | // Copyright 2018 Developers of the Rand project. |
2 | // |
3 | // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or |
4 | // https://www.apache.org/licenses/LICENSE-2.0> or the MIT license |
5 | // <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your |
6 | // option. This file may not be copied, modified, or distributed |
7 | // except according to those terms. |
8 | #![cfg_attr (docsrs, doc(cfg(feature = "std" )))] |
9 | extern crate std; |
10 | |
11 | use crate::Error; |
12 | use core::convert::From; |
13 | use std::io; |
14 | |
15 | impl From<Error> for io::Error { |
16 | fn from(err: Error) -> Self { |
17 | match err.raw_os_error() { |
18 | Some(errno: i32) => io::Error::from_raw_os_error(code:errno), |
19 | None => io::Error::new(kind:io::ErrorKind::Other, error:err), |
20 | } |
21 | } |
22 | } |
23 | |
24 | impl std::error::Error for Error {} |
25 | |