prost
prost copied to clipboard
support message option?
support message option? e.g.:
syntax = "proto3";
package snazzy.items;
import "uri.proto";
// A snazzy new shirt!
message Shirt {
enum Size {
SMALL = 0;
MEDIUM = 1;
LARGE = 2;
}
string color = 1;
Size size = 2;
option (yyp.uri) = 999; // <==== message option
}
make the option value can be retrieved from the message struct.
uri.proto for references:
syntax = "proto3";
package yyp;
import "google/protobuf/descriptor.proto";
extend google.protobuf.MessageOptions {
uint32 uri = 1001;
}
in python, i can get the option value as following:
def get_yyp_uri(msg):
return msg.DESCRIPTOR.GetOptions().Extensions[yyp_uri_opt]
This would be really useful. I'd like to define some data that relates to some event messages (exchange/topic name) along side the message itself. I can do this if I choose go but I'd like to try it out with rust as well