[![crates.io](https://img.shields.io/crates/v/toad-msg.svg)](https://crates.io/crates/toad-msg)
[![docs.rs](https://docs.rs/toad-msg/badge.svg)](https://docs.rs/toad-msg/latest)
![Maintenance](https://img.shields.io/badge/maintenance-activly--developed-brightgreen.svg)
# toad-msg
Low-level representation of CoAP messages.
The most notable item in `toad_msg` is `Message`;
a CoAP message very close to the actual byte layout.
### Allocation
CoAP messages are growable and dynamically sized:
- The message payload (_http equiv_: the request/response body)
- the number of options (_http equiv_: headers)
- the value of an option (_http equiv_: header value)
### Performance
This crate uses `criterion` to measure performance of the heaped & heapless implementations in this crate as well as `coap_lite::Packet`.
In general, `toad_msg::VecMessage` performs identically to coap_lite (+/- 5%), and both are **much** faster than `toad_msg::ArrayVecMessage`.
Benchmarks:
#### Serializing to bytes
**Click to expand chart**
![chart](https://raw.githubusercontent.com/clov-coffee/toad/main/toad-msg/docs/from_bytes.svg)
#### Deserializing from bytes
**Click to expand chart**
![chart](https://raw.githubusercontent.com/clov-coffee/toad/main/toad-msg/docs/to_bytes.svg)
## License
Licensed under either of
* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or https://www.apache.org/licenses/LICENSE-2.0)
* MIT license ([LICENSE-MIT](LICENSE-MIT) or https://opensource.org/licenses/MIT)
at your option.
### Contribution
Unless you explicitly state otherwise, any contribution intentionally
submitted for inclusion in the work by you, as defined in the Apache-2.0
license, shall be dual licensed as above, without any additional terms or
conditions.