Crate windowed_infinity

Crate windowed_infinity 

Source
Expand description

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).

Structs§

WindowedInfinity
A WindowedInfinity represents an infinite writable space. A small section of it is mapped to a &mut u8 to which writes are forwarded; writes to the area outside only advance a cursor.