Skip to content

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

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

Conversation

Kek5chen
Copy link

@Kek5chen Kek5chen commented Jul 6, 2025

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.

@Kek5chen
Copy link
Author

@KodrAus hey, this has been lying around a bit- could someone of the team have a look? It's not much.

Copy link
Member

@KodrAus KodrAus left a 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())
Copy link
Member

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 🙂

Copy link
Author

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.

Copy link
Member

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.

Copy link
Author

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

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

Successfully merging this pull request may close these issues.

2 participants