Skip to content
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 prost-wkt-derive to derive MessageSerde #69

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

wtzhang23
Copy link

@wtzhang23 wtzhang23 commented Aug 30, 2024

Motivation

Summary of Changes

  • Messages expose their serialization/deserialization methods in a trait-object safe way by using erased_serde
  • Manually implement Serialize and Deserialize for the Any type
    • Serialization involves serializing the type url + value, where the value calls the trait-object's erased_serialize method
    • Deserialization involves lazily deserializing the value into serde_value in case the type url is present afterwards. Once the type url and generic value are both deserialized, the generic value is deserialized using the deserializer callback found in the corresponding entry found in inventory

Breaking Changes

Due to the amount of breaking changes, this PR requires a major version bump.

TODO

  • Optimize querying the inventory by caching type url calls instead of creating a new string.

@fdeantoni
Copy link
Owner

Thanks for creating this PR @wtzhang23! It contains quite a few interesting changes. Can you give a short description of the main changes that are implemented?

@wtzhang23
Copy link
Author

wtzhang23 commented Sep 12, 2024

Updated description

@wtzhang23 wtzhang23 changed the title Demo: add prost-wkt-derive to derive MessageSerde Add prost-wkt-derive to derive MessageSerde Sep 12, 2024
@wtzhang23 wtzhang23 marked this pull request as ready for review September 12, 2024 20:38
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