[][src]Struct httlib_hpack::decoder::Decoder

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

Provides the decoding engine for HTTP/2 headers.

Implementations

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

pub const WITH_INDEXING: u8[src]

A flag indicating that a new header entry has been inserted into the indexing table ([6.2.1.]).

pub const NEVER_INDEXED: u8[src]

A flag indicating a sensitive header field ([6.2.3.]).

pub fn with_dynamic_size(max_dynamic_size: u32) -> Self[src]

Returns a new decoder instance with a desired maximum allowed size of the dynamic table.

pub fn max_dynamic_size(&self) -> u32[src]

Returns the maximum allowed size of the dynamic table.

Note that the dynamic table could actually be of different size. This size is just a hard limit set by the external protocol.

pub fn set_max_dynamic_size(&mut self, size: u32)[src]

Sets the maximum allowed size of the dynamic table.

This size is just a hard limit that should be set by the external protocol. Changing the size will not change the size of the actual underlaying table. The table will be updated through the size update signal when decoding.

pub fn decode(
    &mut self,
    buf: &mut Vec<u8>,
    dst: &mut Vec<(Vec<u8>, Vec<u8>, u8)>
) -> Result<usize, DecoderError>
[src]

Decodes headers provided in HPACK's header field representation format.

The functions consumes the buf of bytes and writes header results to dst. Each item contains header name, value and flags. The decoder will not index fields unless 0x4 flag is returned. When the 0x8 flag is present, the header field should be treated with caution.

Example:

use httlib_hpack::Decoder;
 
let mut decoder = Decoder::default();
let mut dst = Vec::new();
let mut buf = vec![0x80 | 2];
decoder.decode(&mut buf, &mut dst).unwrap();

This function consumes the buffer only if the decoding succeeds. The provided vector will stay untouched in case of an error.

pub fn decode_exact(
    &mut self,
    buf: &mut Vec<u8>,
    dst: &mut Vec<(Vec<u8>, Vec<u8>, u8)>
) -> Result<usize, DecoderError>
[src]

Decodes the exact number of headers from the provided HPACK's sequence, based on the available vector capacity.

The functions consumes the buf of bytes and writes header results to dst. Each item contains header name, value and flags. The decoder will not index fields unless 0x4 flag is returned. When the 0x8 flag is present, the header field should be treated with caution.

Example:

use httlib_hpack::Decoder;
 
let mut decoder = Decoder::default();
let mut dst = Vec::with_capacity(2);
let mut buf = vec![0x80 | 2, 0x80 | 3];
decoder.decode_exact(&mut buf, &mut dst).unwrap();

This function consumes the buffer only if the decoding succeeds. The provided vector will stay untouched in case of an error.

Trait Implementations

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

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

Auto Trait Implementations

impl<'a> RefUnwindSafe for Decoder<'a>

impl<'a> Send for Decoder<'a>

impl<'a> Sync for Decoder<'a>

impl<'a> Unpin for Decoder<'a>

impl<'a> UnwindSafe for Decoder<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.