You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
my proto file
message get_nway_gateways_req
{
required int32 start_pos = 1 ;
required int32 number_per_page = 2;
}
and protoc to python class
then I code it:
For anyone reading this in the future, the structure of @nwaycn's message when serialized is something like this:
(5 bits + 3 bits)
8 bits
(5 bits + 3 bits)
8 bits
field # + wire type
varint
field # + wire type
varint
Two things may surprise you about this:
field number and wire type are combined into a single byte
an int32 doesn't (necessarily) take up 32 bits when serialized
Both of these are intentional design decisions of the protobuf serialization format. While they might not seem intuitive at first, they allow protobufs to be very space-efficient.
my proto file
message get_nway_gateways_req
{
required int32 start_pos = 1 ;
required int32 number_per_page = 2;
}
and protoc to python class
then I code it:
the print is 4
The text was updated successfully, but these errors were encountered: