-
Notifications
You must be signed in to change notification settings - Fork 191
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 endian adapters #416
add endian adapters #416
Conversation
Signed-off-by: Hunar Roop Kahlon <[email protected]>
Signed-off-by: Hunar Roop Kahlon <[email protected]>
Signed-off-by: Hunar Roop Kahlon <[email protected]>
@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 What if we have two functions: |
|
What do we expect a caller to do with a use uuid::{Uuid, adapter::endian};
let uuid: Uuid = endian::Big::from(my_u128).into(); or use uuid::Uuid;
let uuid = Uuid::from_u128_be(my_u128); 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 |
@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 |
I think that's a good compromise :) |
427: Breaking API features and refactoring for `0.8` r=kinggoesgaming a=KodrAus **I'm submitting a(n)** (|feature|refactor|) # Description ## Modules and Errors This PR is a broad refactoring of our error types and module layout. The general pattern I've gone for is: - Define specific error types in submodules. These are currently private. - Collect these specific error types in an opaque root `Error`. All methods return this single `Error` type so it's easier for consumers to carry `uuid::Error`s in their own code. It'll also include some implementations for open PRs as we've been discussing. I imagine we'll want to spend time working through these changes :) I've hidden our `prelude` module for now, because I'm not sure it's something we'll want to stabilize with (it's only got a few bits in it afterall). ## 128bit support Re-enables support for 128-bit numbers in the form of constructors on `Uuid`, following the pattern that method names without an endian suffix are BE. ## No-std Refactors our `no-std` support so we always mark the crate as `no-std` so our std imports are always the same. This simplifies our std/core support so we need fewer modules. ## Timestamps Includes the design proposed in #405 for timestamp support originally implemented by @jonathanstrong. # Related Issue(s) - #406 # Related PR(s) - #405 - #416 Co-authored-by: Ashley Mannix <[email protected]> Co-authored-by: Jonathan Strong <[email protected]>
@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. |
I'm submitting a(n) feature
Description
Add
uuid::adapter::endian::{Big, Little}
.Motivation
Currently we have single representation for
uuid::Uuid
in-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