Add an equivalent to `MAKE_HRESULT`
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 68/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- rust
- Domain
- operating-systems
Research direction
Start by locating the HRESULT new-type and its existing constructors or methods in the repository. Check how public APIs are tested, then add a const-compatible equivalent for MAKE_HRESULT and determine whether the requested component accessors belong in the same change. Done means the helper and any accessors match the Windows macro behavior and have coverage for representative components.
Written by the indexing model from the issue text.
Description
Suggestion
Sometimes, APIs provide some errors defined using the MAKE_HRESULT C macro. Although it is quite simple, when translating such APIs to Rust bindings, there is no equivalent provided here as far as I can tell. It would therefore be nice to include a small helper towards that, if possible compatible with const contexts.
I would see it as an associated function on the HRESULT new-type, for example:
impl HRESULT {
const fn from_components(severity: u32, facility: u32, code: u32) -> Self {
Self(((severity << 31) | (facility << 16) | code) as _)
}
}
It could also be nice to add accessors to these components as well in order to get equivalents of the HRESULT_SEVERITY, HRESULT_FACILITY, and HRESULT_CODE macros too.
- Dominant language
- Rust
- Stars
- 12.8k
- Forks
- 665
- Avg merge
- 7h 9m
- Merged PRs (30d)
- 70
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/windows-rs
-
question
Difficulty 3/5 1-2 days Newbie friendliness 72/100
microsoft/windows-rs#4978 · 1 comment ·
-
question
Difficulty 4/5 3-5 days Newbie friendliness 48/100
microsoft/windows-rs#4977 · 3 comments ·
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 48/100
microsoft/windows-rs#4976 ·
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 30/100
microsoft/windows-rs#4975 ·
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 45/100
microsoft/windows-rs#4974 ·
All issues in microsoft/windows-rs
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
gitbutlerapp/gitbutler#15998 · 1 comment ·
-
bug triage:deciding
Difficulty 1/5 Under an hour Newbie friendliness 88/100
open-telemetry/otel-arrow#4132 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100