microsoft / microsoft/windows-rs
`windows-bindgen` should make use of `Option<NonNull<T>>` instead of `Option<*mut/const T>` for `ptr` params.
- Dominant language
- Rust
- Stars
- 12.8k
- Forks
- 665
- Avg merge
- 7h 9m
- Merged PRs (30d)
- 70
Description
### 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>` 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?
Contributor guide
Research direction
Start by locating windows-bindgen's handling of optional in and out pointer parameters and inspect how those bindings are generated. The work is done when applicable ptr parameters use Option> without losing the intended nullability behavior, and the existing generator checks pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100