Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve HRESULT ergonomics #2843

Merged
merged 4 commits into from
Feb 13, 2024
Merged

Improve HRESULT ergonomics #2843

merged 4 commits into from
Feb 13, 2024

Conversation

kennykerr
Copy link
Collaborator

As you might expect, the HRESULT type is pivotal in the implementation of the bindings produced by windows-rs, whether it's the various implementation inside windows-core or the mountain of bindings produced by the windows-bindgen crate. Early on, I used HRESULT helpers to bootstrap and simplify API call generation but those were never very consistent with the Rust standard library. Here I'm aiming to make that a little less confusing and more consistent with prior art. I also hope to decouple it from the internals of windows-core and make it more generally useful.

Notably, the following has changed:

  • The and_then method is now called map that behaves much like Result::map.
  • A new and_then method is added that behaves much like Result::and_then.
  • The and_some method is gone. This was mostly used internally, but can be implemented in terms of and_then if needed.
  • The from_abi method is gone. This was mostly used internally, but can be implemented in terms of and_then or map.

@kennykerr kennykerr merged commit 7ce7894 into master Feb 13, 2024
65 checks passed
@kennykerr kennykerr deleted the hresult branch February 13, 2024 02:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant