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

windows_bindgen should make use of Option<NonNull<T>> instead of Option<*mut/const T> for ptr params. #3411

Open
chernoivanenkoofficial opened this issue Jan 3, 2025 · 0 comments
Labels
enhancement New feature or request

Comments

@chernoivanenkoofficial
Copy link

Suggestion

Currently, a lot of bindings for optional in or out pointer parameters of bindings are using Option around the possibly null pointer, which:

  1. Makes a param size larger then a size of a ptr,
  2. Requires casting to raw pointer to be a real None check and not a no-op.

Making binding rely on Option<NonNull<T>> should be a general and quite easy improvement (though, it will not allow to express if the param can be mutated by bound function). Other then this little drawback, are there any other reasons not to opt for this kind of binding generating?

@chernoivanenkoofficial chernoivanenkoofficial added the enhancement New feature or request label Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant