Skip to main content

Module reader

Module reader 

Source
Expand description

Streaming TLV decoder.

TlvReader::next walks the input one element at a time. Scalars are returned as Element::Scalar; containers emit a Element::ContainerStart immediately followed by the children’s elements and then a matching Element::ContainerEnd. Use TlvReader::read_value to materialise an entire element tree in one call. TlvReader::next_ref is the zero-copy sibling of TlvReader::next: it borrows string/bytes payloads straight from the input instead of allocating, and is the decode core next itself is implemented over.

Structs§

ElementSpan
Byte offsets of one element within a TlvReader’s input, produced by TlvReader::element_span / TlvReader::skip_container_span.
TlvReader
A streaming TLV decoder over a borrowed byte slice.

Enums§

ContainerKind
Which kind of TLV container a ContainerStart announces.
Element
One step of the streaming reader.
ElementRef
One step of the streaming reader, borrowing string/bytes payloads from the input — the zero-copy sibling of Element. Produced by TlvReader::next_ref; convert with Element::from when ownership is needed.

Constants§

DEFAULT_ELEMENT_BUDGET
Default ceiling on the total number of Value elements a single TlvReader::read_value call may materialise.
MAX_DEPTH
Maximum container nesting depth the reader accepts. The Matter spec recommends a 32-level limit to prevent stack blow-up on adversarial input.