Skip to main content

Module framing

Module framing 

Source
Available on crate feature embedded only.
Expand description

Length-prefix framing for EmbeddedLeg.

embedded-io-async is a byte stream; SessionTransport is message- oriented. Each frame is [len: u32 BE][payload] — byte-identical to TcpSessionTransport’s framing, so an embedded client and a TCP server interoperate at this layer. Pure: no I/O and no state — the leg drives the actual reads and writes and owns the buffer.

Phase 3.6 (no-std foundation): pure logic, zero imports outside the prelude. The crate-level #![cfg_attr(not(feature = "std"), no_std)] in lib.rs drives the no_std switch; this module needs no extra attribute.

Enums§

FramingError
Errors from length-prefix framing.

Constants§

HEADER_LEN
Width of the big-endian length prefix prepended to every frame.

Functions§

decode_header
Decode a big-endian length prefix, validating the frame it announces fits a receiver buffer of capacity bytes.
encode_header
Encode the big-endian length prefix for an outbound frame of payload_len bytes, validating it fits a receiver buffer of capacity bytes.