Questions tagged «proto3»

2
为什么在协议缓冲区3中删除了必需和可选的内容
我最近gRPC与proto3和一起使用,并且注意到了这一点,required并且optional已在新语法中将其删除。 有人可以解释一下为什么在proto3中删除了必需/可选吗?此类约束似乎对于使定义更健壮很有必要。 语法proto2: message SearchRequest { required string query = 1; optional int32 page_number = 2; optional int32 result_per_page = 3; } 语法proto3: syntax = "proto3"; message SearchRequest { string query = 1; int32 page_number = 2; int32 result_per_page = 3; }
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.