Skip to content

cobs_codec_rs 1.1.0

Choose a tag to compare

@ajsb85 ajsb85 released this 04 Jul 16:55
v1.1.0
49b1beb

cobs_codec_rs 1.1.0

Three new capabilities for the #![no_std], zero-dependency COBS / COBS-R codec — all additive and backward compatible, and byte-identical to the Dart and Kotlin members of the Firechip COBS family.

✨ New features

Configurable sentinel — frame on any delimiter byte, not just 0x00. New *_with_sentinel variants on both cobs and cobsr (slice and *_to_vec) make the encoded output avoid your chosen byte. It works by XOR-ing the finished encoding with the sentinel, so sentinel == 0 is byte-for-byte identical to the plain codec.

let enc = cobs::encode_to_vec_with_sentinel(&[0x11, 0xAA, 0x22], 0xAA); // [0xAE, 0xBB, 0x00, 0x88] — no 0xAA
cobs::decode_to_vec_with_sentinel(&enc, 0xAA).unwrap();                 // [0x11, 0xAA, 0x22]

In-place decode (basic COBS) — cobs::decode_in_place(&mut buf) decodes within the same buffer and returns the length; COBS never expands on decode, so no second allocation is needed.

Allocation-free streamingframing::StreamDecoder reassembles delimiter-framed packets into a caller-provided fixed buffer: the pure-no_std counterpart of FrameDecoder, with .reduced() (COBS/R) and .sentinel() options.

✅ Verified

  • clippy pedantic clean (all-features and no_std), bare-metal thumbv7em-none-eabihf build, MSRV 1.81.
  • 2261 shared conformance vectors + a 19,644-vector differential against the Python reference — byte-identical.

📦 Install

cobs_codec_rs = "1.1"

crates.io: https://crates.io/crates/cobs_codec_rs/1.1.0 · docs: https://docs.rs/cobs_codec_rs/1.1.0

The attached cobs_codec_rs-1.1.0.crate is the exact published source distribution.