#coap #no-alloc

no-std windowed-infinity

A data structure representing an infinite sequentially writable u8 vector of which a small view has writes to it preserved. This is primarily useful when implementing CoAP block-wise transfers, and also convenient for logging on constrained devices.

11 releases

0.2.0 Oct 9, 2025
0.1.9 Jul 19, 2025
0.1.8 Mar 5, 2025
0.1.7 Oct 30, 2024
0.1.0 Jan 22, 2019

#496 in Data structures

Download history 2017/week @ 2025-07-17 313/week @ 2025-07-24 216/week @ 2025-07-31 458/week @ 2025-08-07 1011/week @ 2025-08-14 1629/week @ 2025-08-21 1236/week @ 2025-08-28 742/week @ 2025-09-04 1319/week @ 2025-09-11 1285/week @ 2025-09-18 879/week @ 2025-09-25 711/week @ 2025-10-02 1392/week @ 2025-10-09 1896/week @ 2025-10-16 1479/week @ 2025-10-23 1176/week @ 2025-10-30

6,149 downloads per month
Used in 4 crates (via coap-handler-implementati…)

MIT/Apache

12KB
103 lines

windowed-infinity License: MIT OR Apache-2.0 windowed-infinity on crates.io windowed-infinity on docs.rs Source Code Repository Rust Version: 1.82.0

This crate provides the WindowedInfinity struct, which is written to through its methods or embedded_io::Write.

Its purpose is to wrap a small buffer such that writes to it advance a cursor over a larger imaginary buffer, only persisting writes to the small buffer. After the buffer has been processed, a new WindowedInfinity can be set up and the writing process repeated. This is wasteful when the writes are computationally expensive, but convenient when operations only rarely exceed the buffer.

A typical practical example of a WindowedInfinity application is the implementation of CoAP block-wise transfer according to RFC7959; a simpler example is available in the demo.rs example.

This crate provides the bare minimum functionality of Doing One Thing (hopefully) Right. Before adopting embedded_io::Write as The Interface to this crate, it used to provide a Tee adapter (now in tee-embedded-io) as well as implementing other Write traits or providing a compatible implementation into hashes and CRCs (now in extra-embedded-io-adapters). Those crates can be combined, for example, to build a combined writer that hashes its text input while preserving only a small portion in memory, thus allowing checked recombination of the parts (e.g. to provide an ETag value in CoAP block-wise transfer).

Dependencies

~39KB