Why are non-scalar fields defaulted to Option<T> ? #679
-
Hi, 👋 I have a proto3 message Foo with a field 'x' of type Bar, with Bar being another message. Why is this the case? if I want an option could I not just specify the optional modifier? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
This is due to the way that proto3 supports message fields as being optional. Its possible for a field to not be included due to backwards compat. https://github.com/tokio-rs/prost#field-modifiers |
Beta Was this translation helpful? Give feedback.
-
But then again, why are scalars represented as |
Beta Was this translation helpful? Give feedback.
This is due to the way that proto3 supports message fields as being optional. Its possible for a field to not be included due to backwards compat. https://github.com/tokio-rs/prost#field-modifiers