diff --git a/CHANGELOG.md b/CHANGELOG.md index 71f9c7ce8..aa515444c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] + +### Added +- `RawOsError` type alias [#739] + +[#739]: https://github.com/rust-random/getrandom/pull/739 + ## [0.3.4] - 2025-10-14 ### Major change to `wasm_js` backend @@ -631,6 +638,7 @@ Publish initial implementation. ## [0.0.0] - 2019-01-19 Publish an empty template library. +[Unreleased]: https://github.com/rust-random/getrandom/compare/v0.3.4...master [0.3.4]: https://github.com/rust-random/getrandom/compare/v0.3.3...v0.3.4 [0.3.3]: https://github.com/rust-random/getrandom/compare/v0.3.2...v0.3.3 [0.3.2]: https://github.com/rust-random/getrandom/compare/v0.3.1...v0.3.2 diff --git a/src/error.rs b/src/error.rs index 284533d10..99a29aa3d 100644 --- a/src/error.rs +++ b/src/error.rs @@ -3,17 +3,26 @@ extern crate std; use core::fmt; -// This private alias mirrors `std::io::RawOsError`: -// https://doc.rust-lang.org/std/io/type.RawOsError.html) cfg_if::cfg_if!( if #[cfg(target_os = "uefi")] { // See the UEFI spec for more information: // https://uefi.org/specs/UEFI/2.10/Apx_D_Status_Codes.html - type RawOsError = usize; + + /// Raw error code. + /// + /// This alias mirrors unstable [`std::io::RawOsError`]. + /// + /// [`std::io::RawOsError`]: https://doc.rust-lang.org/std/io/type.RawOsError.html + pub type RawOsError = usize; type NonZeroRawOsError = core::num::NonZeroUsize; const UEFI_ERROR_FLAG: RawOsError = 1 << (RawOsError::BITS - 1); } else { - type RawOsError = i32; + /// Raw error code. + /// + /// This alias mirrors unstable [`std::io::RawOsError`]. + /// + /// [`std::io::RawOsError`]: https://doc.rust-lang.org/std/io/type.RawOsError.html + pub type RawOsError = i32; type NonZeroRawOsError = core::num::NonZeroI32; } ); diff --git a/src/lib.rs b/src/lib.rs index adb7e5b7e..c98ea19dc 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -39,7 +39,7 @@ mod util; #[cfg(feature = "std")] mod error_std_impls; -pub use crate::error::Error; +pub use crate::error::{Error, RawOsError}; /// Fill `dest` with random bytes from the system's preferred random number source. ///