Skip to main content

Module delimiter

Module delimiter 

Source
Expand description

Byte-delimited framing.

Frames are separated by a configured delimiter byte sequence (typically \n for newline-terminated text, or \r\n for HTTP-style protocols). The delimiter is stripped from the emitted payload but counted toward Frame::consumed.

§Limits and streaming

Delimited::bounded caps payloads at Delimited::DEFAULT_MAX_PAYLOAD (64 KiB) and Delimited::bounded_to at a limit you choose: use one of them for input from untrusted peers. Delimited::unbounded has no limit, which lets a peer that never sends the delimiter grow the caller’s buffer without bound. Delimited::new keeps the 1.0 unbounded behaviour, is deprecated since 1.2.0, and becomes bounded in 2.0.

When input arrives in pieces, call Framer::next_frame_from or use a StreamDecoder so the search resumes where it stopped instead of rescanning the buffered prefix on every call.

Structs§

Delimited
Byte-delimited framer.