Skip to main content

Module tcp_transport

Module tcp_transport 

Source
Expand description

Length-prefixed SessionTransport over tokio::net::TcpStream.

SessionTransport is message-oriented (returns one frame per recv_bytes), while TCP is a stream. This adapter inserts a 4-byte big-endian length prefix before each frame so the trait contract is preserved.

Phase 2.1: the receive path keeps a single persistent BytesMut accumulator across recv_bytes calls. Each frame is split_to-ed off into an owned Bytes which the caller takes — zero-copy from the accumulator to the returned frame, no per-packet Vec::new alloc.

Structs§

TcpSessionTransport