WIP: add endian adapters #416
No reviewers
Labels
No labels
breaking
bug
dependencies
good first issue
help wanted
unstable
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-uuid-rs/uuid!416
Loading…
Reference in a new issue
No description provided.
Delete branch "adapter/endian-base"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I'm submitting a(n) feature
Description
Add
uuid::adapter::endian::{Big, Little}.Motivation
Currently we have single representation for
uuid::Uuidin-memory. However people have needed for little endian. Particularly bindings have a requirement of the memory layout (see #406).Tests
Currently new tests are needed to be added
Related Issue(s)
#406
@uuid-rs/uuid I need your input on this. I want to make sure I am doing this correct before I add serde and other content to this PR
looks good to me but good to get an opinion from @KodrAus as well
psss.. @KodrAus opinions?
Hmm, I think having types specifically for this might be clumsy to use in practice, because what you really want is a
Uuid, rather than a newtype that wraps it.What if we have two functions:
from_u128_beandfrom_u128_leand either deprecate theFrom<u128>impl or note in the docs that it's platform-dependent? (personally I'd be leaning towards deprecating because it's a bit of a footgun)From<u128>impl was already removed in #407_beand_lemethods be moved to respective endian adapters. This includes theto_fields_{be,le}.What do we expect a caller to do with a
endian::Bigorendian::Little? If its only purpose is to act as a point on your way to aUuidthen it seems like the difference between:or
But if there's something else these adapters would do then maybe they are worth having as separate structs.
One big one I can think is (de)serialization. Especially given that you that uuid is stored in a particular endian and you don't to risk messing up..
That aside I am fine with providing the methods on
Uuiditself@uuid-rs/uuid can I have a resolution on which way I should go on this so I can finish this PR then finish the few documentation bits I want to have in this for the release?
I'm happy for you to take this in the direction you feel is most appropriate.
Personally, I think a combination of constructor methods on
Uuid, and a serialization module likeadapter::compactwould be the most consistent with how we already do things.I think that's a good compromise :)
@KodrAus I should close this... since your PR technically superseded this one
Ah yes that's right. Thanks @kinggoesgaming, I'll close this one now.
Pull request closed