Replies: 1 comment
-
I think what you want to do is convert from the prost rust type -> your domain type and make it such that the only way to do it is via the |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've got various protobuf message types, and I want to have prost deserialization guarantee that they're validated appropriately using ergonomic Rust patterns. For example:
And later in my Rust code, I have something like:
How do I guarantee that EmailAddress::try_from would be called when deserializing an EmailAddress? Effectively this is the Rust newtype pattern, but applied to protobuf message types.
The motivation here is that I want to guarantee data validation, and not have to add validation boilerplate everywhere by hand, potentially missing it somewhere, leaving a security hole.
Beta Was this translation helpful? Give feedback.
All reactions