Struct hpack::decoder::Decoder [] [src]

pub struct Decoder<'a> { /* fields omitted */ }

Decodes headers encoded using HPACK.

For now, incremental decoding is not supported, i.e. it is necessary to pass in the entire encoded representation of all headers to the decoder, rather than processing it piece-by-piece.

Methods

impl<'a> Decoder<'a>
[src]

Represents a decoder of HPACK encoded headers. Maintains the state necessary to correctly decode subsequent HPACK blocks.

Creates a new Decoder with all settings set to default values.

Sets a new maximum dynamic table size for the decoder.

Decodes the headers found in the given buffer buf. Invokes the callback cb for each decoded header in turn, by providing it the header name and value as Cow byte array slices.

The callback is free to decide how to handle the emitted header, however the Cow cannot outlive the closure body without assuming ownership or otherwise copying the contents.

This is due to the fact that the header might be found (fully or partially) in the header table of the decoder, in which case the callback will have received a borrow of its contents. However, when one of the following headers is decoded, it is possible that the header table might have to be modified; so the borrow is only valid until the next header decoding begins, meaning until the end of the callback's body.

If an error is encountered during the decoding of any header, decoding halts and the appropriate error is returned as the Err variant of the Result.

Decode the header block found in the given buffer.

The decoded representation is returned as a sequence of headers, where both the name and value of each header is represented by an owned byte sequence (i.e. Vec<u8>).

The buffer should represent the entire block that should be decoded. For example, in HTTP/2, all continuation frames need to be concatenated to a single buffer before passing them to the decoder.