Encoder and Decoder for HPACK (RFC 7541).
```rust use hpackcodec::{Encoder, Decoder}; use hpackcodec::field::{HeaderField, LiteralHeaderField as Field}; use hpack_codec::table::{StaticEntry, Index};
// Encoding let mut encoder = Encoder::new(4096); let mut header = encoder.enterheaderblock(Vec::new()).unwrap(); header.encodefield(StaticEntry::MethodGet).unwrap(); header.encodefield(Field::withindexedname(StaticEntry::Path, b"/hello")).unwrap(); header.encodefield(Field::new(b"foo", b"bar").withindexing()).unwrap(); header.encodefield(Index::dynamictableoffset() + 0).unwrap(); let encodeddata = header.finish();
// Decoding let mut decoder = Decoder::new(4096); let mut header = decoder.enterheaderblock(&encodeddata[..]).unwrap(); asserteq!(header.decodefield().unwrap(), HeaderField::new(b":method", b"GET").ok()); asserteq!(header.decodefield().unwrap(), HeaderField::new(b":path", b"/hello").ok()); asserteq!(header.decodefield().unwrap(), HeaderField::new(b"foo", b"bar").ok()); asserteq!(header.decode_field().unwrap(), HeaderField::new(b"foo", b"bar").ok()); ```