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

Bump windows to 0.51 #127

Merged
merged 6 commits into from
Aug 24, 2023
Merged

Bump windows to 0.51 #127

merged 6 commits into from
Aug 24, 2023

Conversation

veeenu
Copy link
Owner

@veeenu veeenu commented Aug 22, 2023

This PR bumps windows-rs to the latest 0.51 version.

There are some new patterns to deal with optional out params that windows isn't handling in a very elegant way, e.g. options of options of mutable pointers where the difference between None and Some(null_mut()) is not particularly evident, so some helper functions to deal with these cases should be added and applied:

  • out_param for pre-allocated out parameters
  • try_out_param for pre-allocated out parameters in a fallible function
  • out_ptr for out pointers allocated by the function itself
  • try_out_ptr for out pointers allocated by a fallible function

Example of usage:

let desc = try_out_param(|&mut out| device_and_swap_chain.GetDesc(out))?;

Blocked by #126

@veeenu veeenu mentioned this pull request Aug 24, 2023
Base automatically changed from play-hooky to main August 24, 2023 15:13
@veeenu veeenu marked this pull request as ready for review August 24, 2023 16:16
Copy link
Owner Author

@veeenu veeenu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While the new conventions in windows-rs are a bit verbose, they do feel more consistent, and having to repetitively instantiate None mutable options for storing pointers is easily (if not too elegantly) dealt with by using a couple simple helper functions.

Overall I'm very happy of this version bump because the code feels cleaner in the right spots and we can finally move on and stay aligned with new versions going forward.

As a mostly unrelated bonus, with this PR we officially compile on stable Rust and can finally drop the nightly requirement 🎉

@veeenu veeenu merged commit deaf742 into main Aug 24, 2023
1 check passed
@veeenu veeenu deleted the windows-bump branch August 24, 2023 16:26
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