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 support for uuid::Uuid #34

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

vnghia
Copy link

@vnghia vnghia commented Aug 24, 2024

Close #33

@finnbear
Copy link
Member

Thanks for the PR! Here are a few thoughts:

  • I'm in favor of accepting this impl if uuid doesn't want to derive it 👍
  • The binary representation you chose differs from Add bitcode support uuid-rs/uuid#739. Theirs encodes a [u8; 16] whereas yours encodes a u128. There may be an alignment difference and, for that and other reasons, performance difference. I'll personally benchmark this before merging.
  • I'd like to use the strategy I used in Add support for std::net::{*Addr*} #30 to avoid writing custom code each time we need to encode one type in terms of another. That's not reviewed/merged yet so this will have to wait.

@finnbear finnbear added the enhancement New feature or request label Aug 25, 2024
@finnbear finnbear changed the title feat: add support for encode/decode uuid feat: add support for encode/decode uuid::Uuid Aug 25, 2024
@finnbear finnbear changed the title feat: add support for encode/decode uuid::Uuid Add support for uuid::Uuid Aug 25, 2024
@vnghia
Copy link
Author

vnghia commented Sep 13, 2024

Hi @finnbear, I use the new approach as you mentioned. Essentially just move ConvertFrom related code to a new mod and use that for encode/decode uuid. I let you decide which binary representation to go (u128 vs [u8;16]) but I think it is done on my side.

@finnbear
Copy link
Member

Thanks for this! Regarding the encoding process, @caibear has recently started experimenting with using uuid's support for bytemuck to make it more efficient than what I suggested. I'll keep you updated :)

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

Successfully merging this pull request may close these issues.

Support for UUID
2 participants