winpty-rs-windows-result

Crates.iowinpty-rs-windows-result
lib.rswinpty-rs-windows-result
version0.3.4
created_at2025-08-04 21:01:00.973854+00
updated_at2025-08-04 21:01:00.973854+00
descriptionWindows error handling
homepage
repositoryhttps://github.com/microsoft/windows-rs
max_upload_size
id1781161
size42,860
Edgar Andrés Margffoy Tuay (andfoy)

documentation

README

Windows error handling

The windows-result crate provides efficient Windows error handling and propagation with support for Win32, COM, and WinRT APIs.

Start by adding the following to your Cargo.toml file:

[dependencies.winpty-rs-windows-result]
version = "0.3"

Use the HRESULT, Error, and specialized Result types as needed:

use winpty_rs_windows_result::*;

const S_OK: HRESULT = HRESULT(0);
const ERROR_CANCELLED: u32 = 1223;
const E_CANCELLED: HRESULT = HRESULT::from_win32(ERROR_CANCELLED);

fn main() -> Result<()> {
    S_OK.ok()?;
    let e = Error::new(E_CANCELLED, "test message");
    assert_eq!(e.code(), E_CANCELLED);
    assert_eq!(e.message(), "test message");
    Ok(())
}
Commit count: 1734

cargo fmt