Feature request: windows_bindgen::standalone
should allow specifying specific enum constants
#2409
Labels
enhancement
New feature or request
Motivation
Currently,
windows_bindgen::standalone
will emit every constant in an enum with no way to filter to only the ones that are needed by the crate using the bindings. As a consequence#![allow(dead_code)]
is always emitted in the generated bindings so the user doesn't get warnings for the unused constants.Drawbacks
In a vast majority of use cases, only a small fraction of enum values are used from any particular enum, from the relatively tame
PAGE_
flags enum to the frankly insane (at the time of this writing) 3240 itemWIN32_ERROR
. While it's not the end of the world, refining the emitted items to only the ones requested by the user means less generated code and thus less code to compile.Rationale and alternatives
The impact of not doing this is that crates which generate enum bindings with
windows_bindgen::standalone
will almost always be compiling code they don't use. This cost will be negligible in the grand scheme of things, but there's also no reason to give the compiler more work to do if it can be avoided. It also means that if the user manually removes the items they don't use, regenerating the bindings will need manual cleanup every time rather than just having a feature to always emit bindings without a need for manual fixup.Additional context
No response
The text was updated successfully, but these errors were encountered: