X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=vendor%2Fgetrandom%2Fsrc%2Ferror_impls.rs;fp=vendor%2Fgetrandom%2Fsrc%2Ferror_impls.rs;h=5cb88405fcac21e60be371e3f407b534d5ef5830;hb=a33a295584b7f296fedf3a50990e6b12210adf59;hp=0000000000000000000000000000000000000000;hpb=9c18a685fcfe68770bcd6ddb2059847f28403b69;p=rustc.git diff --git a/vendor/getrandom/src/error_impls.rs b/vendor/getrandom/src/error_impls.rs new file mode 100644 index 0000000000..5cb88405fc --- /dev/null +++ b/vendor/getrandom/src/error_impls.rs @@ -0,0 +1,23 @@ +// Copyright 2018 Developers of the Rand project. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. +extern crate std; + +use crate::Error; +use core::convert::From; +use std::io; + +impl From 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 {}