diff options
Diffstat (limited to 'vendor/getrandom/src/error_std_impls.rs')
| -rw-r--r-- | vendor/getrandom/src/error_std_impls.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/vendor/getrandom/src/error_std_impls.rs b/vendor/getrandom/src/error_std_impls.rs new file mode 100644 index 00000000..2c326012 --- /dev/null +++ b/vendor/getrandom/src/error_std_impls.rs @@ -0,0 +1,15 @@ +extern crate std; + +use crate::Error; +use std::io; + +impl From<Error> for io::Error { + fn from(err: Error) -> Self { + match err.raw_os_error() { + Some(errno) => io::Error::from_raw_os_error(errno), + None => io::Error::new(io::ErrorKind::Other, err), + } + } +} + +impl std::error::Error for Error {} |
