Anybuf is a minimal (like seriously), zero dependency protobuf encoder
to encode anything.
It is designed to create the value
bytes of a protobuf Any
, hence the name.
Anybuf allows you to do things wrong in many ways and you should have a solid understanding of how protobuf encoding works in general to better understand the API.
Anybuf
instance```rust use anybuf::Anybuf;
let data = Anybuf::new() .appenduint64(1, 4) // field number 1 gets value 4 .appendstring(2, "hello") // field number 2 gets a string .appendbytes(3, b"hello") // field number 3 gets bytes .appendmessage(4, &Anybuf::new().appendbool(3, true)) // field 4 gets a message .appenduint64(5, 23) // field number 5 is a repeated uint64 .appenduint64(5, 56) .appenduint64(5, 192) .into_vec(); // done
// data is now a serialized protobuf doocument ```