Skip to main content

Module protobuf

Module protobuf 

Source
Expand description

A minimal no_std + no_alloc Protocol Buffers v3 wire-format decoder, sufficient for walking ONNX ModelProto messages by reference.

Because uor-addr is no_std + no_alloc by default, the ONNX realization hand-writes the protobuf decode rather than pulling in prost / protobuf (which require alloc). The decoder is reference-based: it walks the input bytes, validates field numbers / wire types, and yields borrowed field views — it never copies.

Authoritative source: https://protobuf.dev/programming-guides/encoding/.

Re-exports§

pub use tag::Tag;
pub use tag::WireType;
pub use varint::read_varint;
pub use wire::Field;
pub use wire::FieldValue;
pub use wire::MessageReader;
pub use wire::WireError;

Modules§

tag
Protobuf field tags: tag = (field_number << 3) | wire_type.
varint
Base-128 varint decoding (protobuf v3 wire format §“Base 128 Varints”): each byte’s high bit is a continuation flag; the low 7 bits are data, least-significant group first.
wire
Field-level protobuf reader: iterates the fields of a message, yielding borrowed Field views. No allocation; the reader holds a &[u8] and a cursor.