cobs
This is an implementation of the Consistent Overhead Byte Stuffing (COBS) algorithm. COBS is an algorithm for transforming a message into an encoding where a specific value (the "sentinel" value) is not used. This value can then be used to mark frame boundaries in a serial communication channel.
0.5.1
54M downloads/mo
#1167 most downloaded on crates.io
jamesmunns/cobs.rs
What this package is like to depend on
Last release 5 months ago
03 Mar 2026
Release timing varies
gaps range from 4 months to 3.2 years
Some releases are documented
notes for 4 of 12 stable releases
Nothing withdrawn
no release was ever pulled
11 years old
12 releases · first in 2015
2 releases in the last 12 months
see the full history below
Release timeline
12 releases · Aug 2015 to Mar 2026Releases
latest 12-
0.5.103 Mar 2026 -
0.5.021 Oct 2025Release notes
Open source →- Introduce MSRV, which is Rust 1.86
- Move to Rust edition 2024
Added
- New API to encoded data including the sentinel bytes:
encode_including_sentinelstry_encode_including_sentinelsencode_vec_including_sentinels
CobsDecoderOwnedwhich owns the decoding buffer and does not require lifetimes.CobsDecoderHeaplesswhich owns the heapless decoding buffer and does not require lifetimes.
Release notes
Open source →- Introduce MSRV, which is Rust 1.86
- Move to Rust edition 2024
Added
- New API to encoded data including the sentinel bytes:
encode_including_sentinelstry_encode_including_sentinelsencode_vec_including_sentinels
CobsDecoderOwnedwhich owns the decoding buffer and does not require lifetimes.CobsDecoderHeaplesswhich owns the heapless decoding buffer and does not require lifetimes.
-
0.4.021 Jun 2025Release notes
Open source →Fixed
- The encoder functions will now encode empty input into a single 0x01 byte.
#49
Changed
- Bumped
defmtdependency to v1
#51 decodenow returns theDecodeReportstructure which contains both the frame size
and the parsed size.
#50CobsDecoder::pushalso returns aDecodeReportnow.
#50- The
DecodeReportstructure now hasframe_sizeandparsed_sizegetter methods instead
of publicsrc_used/dst_usedfields.
#50 - The
CobsDecoderis now able to continuously parse data without having to re-create
it after each parsed packet.
#50
Release notes
Open source →Fixed
- The encoder functions will now encode empty input into a single 0x01 byte. #49
Changed
- Bumped
defmtdependency to v1 #51 decodenow returns theDecodeReportstructure which contains both the frame size and the parsed size. #50CobsDecoder::pushalso returns aDecodeReportnow. #50- The
DecodeReportstructure now hasframe_sizeandparsed_sizegetter methods instead of publicsrc_used/dst_usedfields. #50 - The
CobsDecoderis now able to continuously parse data without having to re-create it after each parsed packet. #50
- The encoder functions will now encode empty input into a single 0x01 byte.
-
0.3.031 Jan 2025Release notes
Open source →This release (the first in a very long time) has been led by @robamu - huge thanks to him for making this happen!
What's Changed
- all easy clippy fixes and cargo fmt by @robamu in #21
- Make overhead and encoding len functions const by @robamu in #20
- Possible encoder bugfix by @robamu in #22
- add changelog by @robamu in #28
- Better error handling by @robamu in #30
- Add GitHub CI by @robamu in #31
- changelog update by @robamu in #33
- improve documentation, clarify behaviour regarding sentinel value by @robamu in #29
- bump rust edition to 2021 by @robamu in #34
- actually forgot the bump.. by @robamu in #35
- avoid panic on decode calls by @robamu in #36
- basic tests for encoder errors by @robamu in #37
allocfeature that is stillno_stdby @jscatena88 in #24- new alloc and std feature by @robamu in #38
- chore: update quickcheck dependency by @kaffarell in #25
- DecodeError tweak and consisten decode error behaviour by @robamu in #39
- add optional defmt support by @robamu in #40
- remove travis CI by @robamu in #42
- add optional serde support by @robamu in #41
- various improvements for documentation by @robamu in #43
- basic decoder error check by @robamu in #44
- prepare v0.3.0 by @robamu in #45
New Contributors
- @robamu made their first contribution in #21
- @jscatena88 made their first contribution in #24
- @kaffarell made their first contribution in #25
Full Changelog: v0.2.3...v0.3.0
Release notes
Open source →Added
- Added
max_encoding_overheadconst function. #20 - Unittests for
decode_in_placeanddecode_in_place_report. #36 - New
allocfeature which enables support for APIs returningVecs. #24 - New
stdfeature, deprecate theuse_stdfeature but keep it for backwards compatiblity. #38 - Documentation of the new
stdandallocfeatures in the README. #38 - Optional
defmtsupport feature-gated by the optionaldefmtfeature. #40 - Add optional
serdesupport that addsserdederives for some errors and data structures. #41
Changed
- Bumped rust edition to 2021
- Improved error handling by replacing unit errors with a new
DecodeErrorenumeration for the decoding module and aDestBufTooSmallErrorfor the encoding module. #30 max_encoding_lengthis now a const function. #20decode_in_placeanddecode_in_place_reportnow check the destination index and return an appropriateDecodeErrorinstead of panicking if an out-of-bounds access happens. #36- Consistent behaviour of decode functions for empty input: All funtions now return
DecodeError::FrameEmpty. #39
Fixed
- Fixed wrong encoded length when source length was divisible by 254. #19
-
0.2.314 Jun 2022Nothing published for this version
-
0.2.214 Jun 2022Nothing published for this version
-
0.2.114 Jun 2022Nothing published for this version
-
0.2.014 Jun 2022Nothing published for this version
-
0.1.402 Apr 2019Nothing published for this version
-
0.1.321 Dec 2017Nothing published for this version
-
0.1.215 Jan 2016Nothing published for this version
-
0.1.105 Aug 2015Nothing published for this version