std::encoding::protobufProtocol Buffers message construction.
Build and inspect Protocol Buffers messages using a field-number based API. Supports string and varint (integer) fields.
Note: Encoding/decoding to wire format and byte-typed field
operations (set_bytes, get_bytes) require byte array support
not yet available in Hew.
import std::encoding::protobuf;
fn main() {
let msg = protobuf.new();
msg.set_varint(1, 42);
msg.set_string(2, "hello");
let val = msg.get_string(2);
println(val);
msg.free();
}
newCreate a new empty Protocol Buffers message.
let msg = protobuf.new();
msg.set_varint(1, 100);
msg.free();
MessageAn opaque Protocol Buffers message.
Created by protobuf.new(). Fields are accessed by their field
number. Must be freed with free() when no longer needed.
MessageMethodsMethods available on a protobuf Message.