@@ -13,11 +13,19 @@ a length byte. This requires a lookahead of up to 254 bytes when doing streaming
13
13
14
14
rCOBS outputs the length byte at the * end* of the chunk instead of at the start, completely
15
15
eliminating the lookahead requirement for encoding. The tradeoff is decoding now has to be done starting
16
- from the * end* of the message backwards, so no lookahead is possible. The message has to be
17
- read in its entirety before it can be decoded.
16
+ from the * end* of the message backwards, so streaming decode is not possible at all . The message has to be
17
+ read in its entirety into a buffer before it can be decoded.
18
18
19
19
This makes rCOBS ideal for situations where data is * encoded* in constrained, embedded systems and * decoded* in
20
- more capable systems, where the full buffering requirement is not a problem.
20
+ more capable systems, where the full buffering requirement is not a problem, such as:
21
+
22
+ - Logging
23
+ - Crash reporting
24
+ - Telemetry/monitoring
25
+ - Sensor data feeds
26
+
27
+ This crate implements a streaming ` no-std ` -friendly encoder, and a non-streaming ` std ` -only decoder (enabled with ` std ` Cargo feature).
28
+ ` no-std ` decoding is intentionally not provided: if you need to decode on embedded devices, standard COBS is a better fit for you.
21
29
22
30
## Examples
23
31
@@ -31,12 +39,16 @@ rCOBS-encoded: 11 22 33 44 05
31
39
Message: 11 22 00 33
32
40
COBS-encoded: 03 11 22 02 33
33
41
rCOBS-encoded: 11 22 03 33 02
34
-
42
+ Cr
35
43
Message: 11 00 00 00 42 42 42
36
44
COBS-encoded: 02 11 01 01 04 42 42 42
37
45
rCOBS-encoded: 11 02 01 01 42 42 42 04
38
46
```
39
47
48
+ ## Credits
49
+
50
+ Idea of reversing COBS to allow encoding with no lookahead by @jamesmunns . Implementation by @dirbaio .
51
+
40
52
## License
41
53
42
54
This work is licensed under either of
0 commit comments