#[non_exhaustive]pub enum ChunkStep {
Data {
skip: usize,
len: usize,
},
NeedMore {
consumed: usize,
},
Trailers {
skip: usize,
len: usize,
},
Done {
consumed: usize,
},
}Expand description
One step of ChunkedDecoder::decode, with explicit byte accounting so
a caller can decode in place in its own buffer. Offsets are relative to
the input of that call.
§Examples
See ChunkedDecoder.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Data
Skip skip framing bytes, then len bytes are body data; consume
both (skip + len) and call again with what follows.
NeedMore
More input is needed: drop the first consumed bytes (framing that
was read), keep the rest, append more, and call again.
Trailers
Skip skip framing bytes, then len bytes are the trailer section
(its field lines and the blank line), already validated; consume
both, and the next call reports ChunkStep::Done. Only reported for
a section that has at least one field.
The bytes are validated, not filtered: a section may name
content-length, transfer-encoding, or host, which the
connections drop from their trailer events (RFC 9110 section 6.5.1).
A proxy must not relay these bytes as they are; re-emit the fields it
keeps with end_body_with_trailers, which refuses the names a
trailer may not carry.
Fields
Done
The body is complete after consumed more bytes (the last chunk and
an empty trailer section); what follows belongs to the next message.