#buffer #protobuf #serialization #binary-encoding #protocols #experimental #alloc

no-std noproto

no-std, no-alloc protocol buffers implementation for embedded systems

2 unstable releases

0.1.0 Dec 20, 2023
0.0.0 Jun 15, 2023

#1917 in Embedded development

Download history 14/week @ 2024-06-16 19/week @ 2024-06-23 6/week @ 2024-06-30 12/week @ 2024-07-07 15/week @ 2024-07-14 24/week @ 2024-07-21 23/week @ 2024-07-28 19/week @ 2024-08-04 13/week @ 2024-08-11 10/week @ 2024-08-18 15/week @ 2024-08-25 9/week @ 2024-09-01 24/week @ 2024-09-08 20/week @ 2024-09-15 30/week @ 2024-09-22 30/week @ 2024-09-29

105 downloads per month
Used in embassy-net-esp-hosted

MIT/Apache

25KB
526 lines

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, ☢️ 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

Protobuf Rust
bool bool
int32 TODO
uint32 u32
sint32 i32
fixed32 TODO
sfixed32 TODO
int64 TODO
uint64 u64
sint64 i64
fixed64 TODO
sfixed64 TODO
float TODO
double TODO
string heapless::String<N>
bytes heapless::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.

Dependencies

~440–780KB
~17K SLoC