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

Simplify use of unscoped enums #843

Merged
merged 1 commit into from
Jun 8, 2021
Merged

Simplify use of unscoped enums #843

merged 1 commit into from
Jun 8, 2021

Conversation

kennykerr
Copy link
Collaborator

Fixes #831

A few things to note about this change. Build macros are generally less cluttered as only the enum type needs to be mentioned (not individual constants). Generated bindings are generally longer but large numbers of constants has a minimal effect on build time (thus worthwhile tradeoff for usability).

cc @roblabla

@kennykerr kennykerr merged commit 4819651 into master Jun 8, 2021
@kennykerr kennykerr deleted the scoped branch June 8, 2021 02:32
@@ -1,5 +1,5 @@
fn main() {
windows::build! {
Windows::Win32::UI::WindowsAndMessaging::{MessageBoxA, MB_OK}
Windows::Win32::UI::WindowsAndMessaging::{MessageBoxA}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't #828 have collapsed that into Windows::Win32::UI::WindowsAndMessaging::MessageBoxA, observed a non-empty git diff, and failed the CI?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tim-weis This is only a single use-statement. #828 turns that into:

use format_build_macro::{
    Windows::Win32::UI::WindowsAndMessaging::{MessageBoxA}
};

Which is then formatted to:

use format_build_macro::Windows::Win32::UI::WindowsAndMessaging::MessageBoxA;

The original use format_build_macro::{ pattern is now gone (missing trailing curly brace) meaning we cannot easily go back to windows::build! {. I'll be testing some ideas locally to deal with these files locally, and submit the cleanup for these cases (of which there seem to be quite a few) later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve usability of scoped enums
3 participants