Crate pbf

source ·
Expand description

The pbf Rust crate provides functionalities to read and write Protocol Buffers (protobuf) messages. This crate is a 0 dependency package that uses no_std and is intended to be used in embedded systems and WASM applications. The crate is designed to be small and efficient, with the cost of some features and flexibility. It is up to the user to create the necessary data structures and implement the ProtoRead and ProtoWrite traits in order to use it effectively.

Modules§

  • All encoding and decoding is done via u64. So all types must implement this trait to be able to be encoded and decoded.

Structs§

  • The Field struct contains a tag and a type. The tag is used to track the data type in the message for decoding. The type is used to determine how to encode and decode the field.
  • The Protobuf struct is used to read and write protobuf messages.

Enums§

  • The Type enum represents the different types that a field can have in a protobuf message. The Type enum is used to determine how to encode and decode the field.

Traits§

  • The ProtoRead trait is used to read a protobuf message. This crate forces the user to implement this trait in order to read a protobuf message.
  • The ProtoWrite trait is used to write a protobuf message. This crate forces the user to implement this trait in order to write a protobuf message.

Functions§

  • convert an unsigned integer to a signed integer using zigzag decoding.
  • convert a signed integer to an unsigned integer using zigzag encoding.