-
Notifications
You must be signed in to change notification settings - Fork 220
Implement deserialize for format uuid types #832
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
base: main
Are you sure you want to change the base?
Conversation
@KodrAus hey, this has been lying around a bit- could someone of the team have a look? It's not much. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the ping @Kek5chen!
where | ||
D: serde::Deserializer<'de>, | ||
{ | ||
Ok(Uuid::deserialize(deserializer)?.into()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you're trying to deserialize a UUID into one of these proxy types, I think we should only accept a UUID in its format. We should be able to make the visitor used in Uuid
's deserialize impl generic and add appropriate FromStr
implementations to the proxy types. Then the bound on that visitor would be any T: FromStr + From<Uuid>
.
I'd be happy to sketch it out a bit further if that would be helpful 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really understand what your goal is. The proxy types are just formatting wrappers that each just simply hold a Uuid in a Unit struct. Anything that is a Uuid can be wrapped in these proxy types.
You mean, that if you wish to deserialise a Hyphenated, the input may only be a hyphenated?
If yes, I think I get what you mean.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Kek5chen That’s right; I think deserlializing a hyphenated UUID should only succeed on a hyphenated input.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright, I can change it to have that behavior
Finished the work stated in #534 and only partially implemented in #546 .
Implemented deserialize for format types
Refactors serialize statements into a macro call for brevity.