Apparently Protocol Buffers are capable of storing dynamic structs by using google.protobuf.Struct
. If I don't need the ability to do a 1:1 mapping to JSON, I could use something similar but include a bytes
scalar instead of a string
scalar, or even both.
So Protocol Buffers seem to cover a wide range of scenarios, both where little is known about the transmitted data, as well as cases where the data is pretty rigid (in which case you don't need to transmit field names).
I see there are several Rust crates which address Protocol Buffers:
-
protobuf
(currently is looking for a new maintainer) quick-protobuf
-
prost
(as already mentioned by @jofas) -
serde-protobuf
(Maybe still in development? Says it doesn't support serialization.)
Any advice/comments on the first three crates listed? Edit: I opened a new thread regarding Protocol Buffers.