Skip to content

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

Open
@chernoivanenkoofficial

Description

@chernoivanenkoofficial

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions