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

Handling endian Uuids #462

Closed
kinggoesgaming opened this issue Mar 7, 2020 · 6 comments
Closed

Handling endian Uuids #462

kinggoesgaming opened this issue Mar 7, 2020 · 6 comments

Comments

@kinggoesgaming
Copy link
Member

Based on #461 by @DianaNites


Lack of proper little-endian support, which was partially removed?

This also plays into my confusion, theres Uuid::(to/from)_fields_le and Uuid::(to/from)_u128_le, but not Uuid::from_bytes_le? Theres Uuid::as_bytes but not Uuid::as_bytes_le?

This in particular is complicating things for me, as the Uuids I want to handle are "inspired" by Microsoft and stored mixed-endian. (Also, something I encountered when switching the bytes myself is Uuid::get_version_num returning 14 instead of 4, so those specific last few bits may need special handling?)

@KodrAus
Copy link
Member

KodrAus commented Mar 11, 2020

I think missing from_bytes_le and to_bytes_le may be an oversight. We could support them, by internally treating the integers encoded as bytes as being little endian (this is different from u128, where we flip the whole buffer).

@KodrAus
Copy link
Member

KodrAus commented Aug 13, 2021

Coming back to this, I don't think from_bytes_le or to_bytes_le really make sense, because there's nothing to flip. Our current _le methods assume any integer inputs need to be flipped, but in from_bytes and to_bytes there aren't any integers in the input or output.

@KodrAus
Copy link
Member

KodrAus commented Oct 28, 2021

Just coming in through some triage. I think our _le methods are in good shape now and have some reasonable documentation that demonstrates how they work.

@KodrAus KodrAus closed this as completed Oct 28, 2021
@KodrAus
Copy link
Member

KodrAus commented Nov 1, 2021

Coming back to this, I don't think from_bytes_le or to_bytes_le really make sense, because there's nothing to flip.

Coming back to coming back to this, I think this isn't a very helpful stance. There is of course something to flip in from_bytes: the fields encoded in the buffer. So in #544 I've added from_bytes_le and from_slice_le methods that take care of this for you.

@dfaust
Copy link
Contributor

dfaust commented Apr 25, 2022

Since we now have from_bytes_le, I think we should also have to_bytes_le.
If you want me to write a PR, let me know.

@KodrAus
Copy link
Member

KodrAus commented May 3, 2022

Hi @dfaust 👋

This sounds reasonable to me!

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

No branches or pull requests

3 participants