Skip to main content

Module codec

Module codec 

Source
Expand description

Bounded, runtime-neutral wire codecs.

These codecs only understand transport framing and JSON syntax. They do not decode vendor objects, perform conversion, or preserve unknown application fields as a common representation.

Structs§

CodecError
A codec failure with an optional lower-level source.
CodecLimits
Explicit bounds required by every decoder and encoder.
JsonArrayDecoder
Parses array elements only once a delimiter establishes the token boundary. The retained buffer is one value, independent of transport chunk size.
JsonArrayEncoder
JsonDecoder
MultipartDecoder
Each part owns a real field stream. Consume/drop it before next_part; dropping an unread field lets multer discard it under the same size limits. The caller driving next_part OR the returned body drives the original input. On wasm only the private queue is Send; the original stream stays !Send.
MultipartEncoder
NdjsonDecoder
Accepts LF/CRLF and an optional final complete JSON line without LF.
NdjsonEncoder
SseDecoder
Incremental LF/CRLF/CR framing. Invalid UTF-8 is rejected rather than replaced. finish rejects a pending data event instead of dispatching an event without its required blank-line delimiter. A final partial comment or field line is also rejected. No vendor lifecycle is inferred from EOF.
SseEncoder
SseEvent
Parsed SSE data event. id and retry are effective connection settings, including values supplied in earlier control-only blocks.

Enums§

CodecErrorKind
CodecErrorStage
SseFrame

Functions§

decode_json
encode_json
encode_sse_done
Literal marker bytes, not a complete streaming encoder; SseEncoder::done accounts this marker against the enclosing body limit.
encode_sse_event
Encodes one event. Use SseEncoder for cumulative limits over a whole body.
read_http_body
Consumes one HTTP body under an aggregate byte limit.

Type Aliases§

CodecFuture
A boxed codec operation future. Native futures are Send; wasm follows the connection stream contract and does not require Send.