Expand description
Incremental SSE and newline-delimited framing of response bytes.
SSE dispatch requires a blank line; incomplete events are not flushed at EOF.
NDJSON permits a final unterminated line through NdjsonFramer::finish.
A framer holds at most its limit (FRAME_LIMIT unless given another)
plus one byte of a frame: a larger frame is refused as TooLarge.
use rig_http::http_client::framing::NdjsonFramer;
let mut framer = NdjsonFramer::new();
assert_eq!(framer.push(b"{}\n").collect::<Vec<_>>(), vec![Ok(b"{}".to_vec())]);Structs§
- Framer
- The incremental framer of one streamed reply, from
Framing::framer. - Ndjson
Framer - Splits nonempty newline-delimited payloads without validating JSON.
A nonempty unterminated last line is available through
Self::finish. A line counts its bytes before its line end, LF or CRLF. - Recorded
SseEvent - A parsed event and the byte offset where it became dispatchable.
- SseBatch
- Parsed events and source lines consumed by a recording operation.
- SseEvent
- One dispatched
text/event-streamevent. - SseFramer
- A push parser for the WHATWG
text/event-streamgrammar, which holds at most its limit plus one byte of an event (TooLarge). - SseLine
- Original byte ranges of one line consumed by
SseFramer. - TooLarge
- A frame, line or input larger than its reader’s limit, refused before the reader’s buffer grew past it.
Enums§
- Framing
- How a reply’s bytes are split into wire frames.
- SseField
- A field recognized by the SSE grammar.
- Wire
Frame - One transport frame, after framing but before decoding.
Constants§
- FRAME_
LIMIT - The most bytes one frame of a streamed reply may hold: an SSE event’s lines since the last blank line that a framer keeps (its data and any unfinished line), or an NDJSON line. Far above any real frame, and below what would exhaust memory.