ucpack 0.1.3

Rust implementation of the ucpack serialization format used in the Arduino Alvik
Documentation
  • Coverage
  • 51.52%
    17 out of 33 items documented1 out of 20 items with examples
  • Size
  • Source code size: 104.72 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 4.37 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 23s Average build duration of successful builds.
  • all releases: 22s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • BRA1L0R

ucpack docs.rs

Rust implementation of the ucpack serialization format used in the Arduino Alvik using serde.

This crate does not implement the body API itself, but rather the binary protocol and format it uses to encode its messages.

The crate

This crate exposes a struct called UcPack which you can initialize to start encoding and decoding serde compatible data types and structures.

[!WARNING] Not every type is compatible with ucpack. Namely any integer above 16 bits, lists and maps.

You can also const initialize UcPack and use it const-ly from anywhere if carrying state isn't an option:

const packer: UcPack = UcPack::new(b'A', b'#');

fn main() {
    packer.serialize_slice(...); // ecc..
}

The protocol

NOTE: Table gently borrowed from ucpack's c++ repo

A packet is managed as:

index_byte message length message stop_byte crc8
1 byte (default A) 1 byte N bytes from message length 1 byte (default #) 1 byte

This crate, opposed to the c++ and micropython respectives, is agnostic across the message content (referred to by the name payload in this crate).