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 GUID::to_u128 #1756

Merged
merged 5 commits into from
May 13, 2022
Merged

Add GUID::to_u128 #1756

merged 5 commits into from
May 13, 2022

Conversation

GamePad64
Copy link
Contributor

@GamePad64 GamePad64 commented May 11, 2022

Now GUID can round-trip to and from u128

Relates to #1306
Closes #1755

@kennykerr
Copy link
Collaborator

Would a From impl be more appropriate? from_u128 exists because From is not const and needs to be for the GUID constants in the windows crate.

@GamePad64
Copy link
Contributor Author

Hmm, implementing From looks good for me. But having a separate const fn is nice, because compiler can optimize it out and it may matter in some cases.

@ghost
Copy link

ghost commented May 11, 2022

CLA assistant check
All CLA requirements met.

@kennykerr
Copy link
Collaborator

I think From is more idiomatic - how about we drop the explicit from_u128 function for now - we can always add a const function down the road if that becomes necessary. Then we just need a basic test in crates/tests/core/tests/guid.rs.

@kennykerr
Copy link
Collaborator

Oh, I see you have one already. I guess there is some symmetry to it. Let's see what others think.

@kennykerr kennykerr requested a review from rylev May 11, 2022 21:53
Copy link
Contributor

@rylev rylev left a comment

Choose a reason for hiding this comment

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

I like the symmetry. Looks good to mem just with one comment

crates/libs/windows/src/core/guid.rs Outdated Show resolved Hide resolved
@GamePad64 GamePad64 requested a review from rylev May 13, 2022 06:55
@rylev
Copy link
Contributor

rylev commented May 13, 2022

Thanks for the contribution! Looks great 😊

@rylev rylev merged commit 68576f3 into microsoft:master May 13, 2022
@GamePad64 GamePad64 deleted the guid_to_u128 branch May 13, 2022 20:58
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.

Feature request: GUID to u128 conversion function
3 participants