Crate noproto

source ·
Expand description

noproto

No-std, no-alloc protocol buffers (protobuf) implementation in Rust, for embedded systems. Optimized for binary size and memory usage, not for performance.

Status: very experimental, :radioactive: do not use in production yet. In particular, it doesn’t handle many protobuf types well (see below).

Features

Implemented:

  • Derive macros.
  • heapless::Vec, heapless::String impls.
  • optional
  • repeated
  • oneof
  • enum

Not implemented (yet?):

  • Support multiple protobuf encodings. Protobuf “types” are more like “type + wire encoding” all in one, so one Rust type can be encoded multiple ways on the wire. noproto currently assumes the Rust type is enough to deduce how it should be encoded on the wire, which is not true.
  • Support more types (see below)
  • Impls for alloc containers (goal is to be no-alloc, but we could still have them optionally).
  • Impls for &[T] for repeated fields (only doable for writing, not reading)
  • Tool to compile .proto files into Rust code.
  • Maps
  • Deprecated field groups.

Type mapping

ProtobufRust
boolbool
int32TODO
uint32u32
sint32i32
fixed32TODO
sfixed32TODO
int64TODO
uint64u64
sint64i64
fixed64TODO
sfixed64TODO
floatTODO
doubleTODO
stringheapless::String<N>
bytesheapless::Vec<u8, N>

Minimum supported Rust version (MSRV)

noproto is guaranteed to compile on the latest stable Rust version at the time of release. It might compile with older versions but that may change in any new patch release.

License

This work is licensed under either of

at your option.

Modules

  • Encoding and decoding of primitive types.

Structs

Enums

Traits

Functions

  • Deserialize a protobuf message from a buffer.
  • Serialize a protobuf message to a buffer.