Feature Request: Support Option<Uuid> in uuid::serde::simple module #840
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#840
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Summary
Add support for serializing and deserializing Option types using the simple UUID format in the uuid::serde::simple module.
Problem
Currently, the uuid::serde::simple module only supports direct Uuid types, but not Option. When attempting to use serde(with = "uuid::serde::simple") on an Option field, the following compilation error occurs:
Current Workaround
Need to implement custom serialization/deserialization functions.
It would be nice if you can do:
uuid::serde::simple::optionThanks for the suggestion @rolandog-kb4. This seems like something that might be better supported by composing
serdeattributes, but there isn't one for optional values. Looking at our implementation, I think adding anoptionsubmodule of each of the existingsimple,hyphenated,urn, etc. that acceptedOption<Uuid>and forwarded to their parent orserialize_none()wouldn't result in a lot more code for us to maintain.