microsoft / microsoft/windows-rs

`windows-bindgen` should generate more specific `Result<T, E>` types

Open
#3,294 5 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Rust
Stars
12.8k
Forks
665
Avg merge
7h 9m
Merged PRs (30d)
70

Description

Rather than folding all error types into the `windows_result::Error` type, APIs can more specifically return `Result`, `Result`, and so on. This would avoid the overhead that necessitated #3126 and allow simple pattern matching for error handling. The reasoning around the Windows-specific `Result` is that it additionally carries any `IErrorInfo` that may have been associated with the calling thread. This turns out to be used by very few APIs but can still be supported as needed through conversion.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in the windows-bindgen generation path and inspect windows_result::Error and the changes discussed in #3126. Trace how APIs currently select Result and identify which generated APIs expose HRESULT or NTSTATUS. Done means supported APIs use specific error types while APIs needing IErrorInfo still convert to the Windows-specific Error type, with coverage for the affected generated bindings.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
operating-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.