Skip to main content

Module embedded

Module embedded 

Source
Available on crate feature embedded only.
Expand description

EmbeddedLeg — a SessionTransport over embedded-io-async byte streams, for UART / serial and other embedded byte transports (Phase 3.4).

§Shape

EmbeddedLeg<R, W, const N: usize> is passive — it holds the read/ write halves of a pre-split transport behind two async_lock mutexes and exposes inherent generic async fn send/recv methods (with the framing logic from framing). The SessionTransport trait impl is per-concrete (R, W) rather than one generic blanket: embedded-io-async’s async-fn-in-trait futures are not Send-bounded, so a generic impl<R, W> cannot satisfy SessionTransport’s + Send future bound (un-expressible in stable Rust without return_type_notation). With concrete R/W the compiler sees the HAL’s actual future and proves Send directly. The impl_embedded_session_transport! macro generates the per-pair impl in one line.

Behind the embedded cargo feature. no_std + alloc-clean — this module only depends on core/alloc, bytes, async_lock, and embedded-io- async.

Phase 3.6 (no-std foundation): production code in this module compiles without std. format! / String / Vec come from alloc, pulled in by the crate-level extern crate alloc; in lib.rs. The #[cfg(test)] block below intentionally stays std-bound — host tests lean on tokio, std::collections::VecDeque, std::sync::Arc, etc.

Modules§

framing
Length-prefix framing for EmbeddedLeg.

Structs§

EmbeddedLeg
Length-prefix transport over embedded-io-async byte streams.