- Varint for u64
- Len for String
It has two lib modules
deserialize
(convert from binary hex value to on of the supported variants, which will have contain the field-number and the value)serialize
(convert a type that implementsProto
into binary protobuf message hex-value)
For more information about the Encoding rules refer to the (official documentation)[https://protobuf.dev/programming-guides/encoding/]
For installation and usage documentation of protoscope
refer the (protoscope github repo)[https://github.com/protocolbuffers/protoscope/]
(As an alternative, in-browser tool see (protobufpal)[https://www.protobufpal.com/])
-
write a pseudo message into file
echo '1: 42' > msg.txt echo '2: {"Foo"}' >> msg.txt
-
convert to binary
protoscope -s msg.txt > msg.bin # look at hex value xxd msg.bin
-
to go from bin to message
protoscope msg.bin
- Support other wire types (other
VARINT
s likebool
, signed numbers, repeated types, nexted types etc.) - Implement derive-macro for
Proto
(at least on structs), which internally converts every field to it'sWireType
equivalent and callsserialize
on it.