Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
15 changes: 11 additions & 4 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,24 @@ 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`:
/// 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`:
/// https://doc.rust-lang.org/std/io/type.RawOsError.html
pub type RawOsError = i32;
type NonZeroRawOsError = core::num::NonZeroI32;
}
);
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
///
Expand Down
Loading