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

Add windows-rs format #84

Closed
wants to merge 2 commits into from

Conversation

merlinz01
Copy link
Contributor

Add a format for GUIDs for the windows Rust crate, like so:

// {f4666fdb-ad36-4d5f-99d6-80c83492f58d}
const __NAME__: GUID = GUID {data1: 0xf4666fdb, data2: 0xad36, data3: 0x4d5f, data4: [0x99, 0xd6, 0x80, 0xc8, 0x34, 0x92, 0xf5, 0x8d]};

Copy link
Owner

@heaths heaths left a comment

Choose a reason for hiding this comment

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

Thank you for the contribution; however, I don't want to start adding overly-specific use cases now that custom formatting is possible. This is likely only specific to Rust - a single language out of nearly countless - and may only be specific to the windows crate or others that are similar. Other GUID implementations might have data0..data3, for example.

That said, the custom formatting won't work for your case, but what might work better is to add custom format specifiers for the constituent parts of a GUID, namely the first i32, second and third i16s, and 4th [u8; 8] that would allow you to add a format to your settings to insert e.g.,

'const _PLACEHOLDER_: GUID = GUID {data1: {x0}, data2: {x1}, data3: {x2}, data4: [{x3,}]};'

Where x[0..4] all return hex-encoded data based on a GUID and, in this example (maybe it's unnecessary), x3, has a comma as the separator. It's likely a different separator wouldn't be necessary, though.

@merlinz01
Copy link
Contributor Author

See #85 for an implementation of your suggestion. I hadn't even seen the option for custom formatting before you pointed it out.

@merlinz01 merlinz01 closed this Feb 8, 2024
@merlinz01 merlinz01 deleted the add-windows-rs-format branch February 8, 2024 19:14
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.

2 participants