StructBuf
This library provides a capacity-limited buffer for encoding and decoding structured data. The primary use case is for safely handling small, variable-length message packets sent over the network or other transports.
The encoder ensures that the message size never exceeds a pre-configured limit. The decoder ensures that malformed or malicious input does not cause the program to panic.
no_std
support
structbuf
is no_std
by default.
Example
cargo add structbuf
use StructBuf;
let mut b = new;
b.append.u8.u16.u8;
// b.u8(4); Would panic
let mut p = b.unpack;
assert_eq!;
assert_eq!;
assert_eq!;
assert!;
assert_eq!;
assert!;