Improve windows-bindgen
reference usability and default reference support
#3492
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
windows-bindgen
overhaul #3359 introduced support for references which are employed to support the dedicatedwindows-numerics
#3488,windows-collections
#3483,windows-future
#3490, and so on. The difficulty is that it can become a little unwieldy to manage the various--reference
options required to tie it all together. Well this update introduces the default, or automatic, reference support making this considerably easier.For starters, there are now default references included for collections, numerics, and futures/async so you don't have to mention these when generating your own bindings.
You can also use the
--no-deps
option if you prefer not to use these default references or would like to control them yourself. The old--no-core
option forsys
style bindings has been replaced with--no-deps
so that there's just one option for this concept of avoiding dependencies.You can also combine the default references with a dependency on the
windows
crate with--reference windows,skip-root,Windows
, or whatever other third party references you may need. The default references will take precedence. This is because the default references tend to be more specific and targeted than thewindows
crate reference, which is easier to treat more liberally in terms of filtering in missing types.I have also added support for wildcard filtering to make it easier to filter, or include, a slew of types with the same type name prefix. For example,
Windows.Foundation.IAsync*
will include all four of the async interfaces.