pub fn error_code_from_win32(code: u32) -> ErrorCodeExpand description
The code a Win32 error names, wrapped as HRESULT_FROM_WIN32 wraps it: a value that is already
an HRESULT – zero, or one with the severity bit set – is taken as it is, and any other
keeps only its low sixteen bits. The rule is win-error-codes’s (HResult::from_win32); the
number space is this crate’s, since the codes this driver reports are HRESULTs.
use win_durable_ioring::{error_code_from_win32, win32_code_of};
// ERROR_IO_DEVICE.
let code = error_code_from_win32(1117);
assert_eq!(code.hresult().cast_unsigned(), 0x8007_045D);
assert_eq!(win32_code_of(code), Some(1117));