pub struct Encoder { /* private fields */ }h3 only.Expand description
QPACK encoder: dynamic table owner and field section encoder.
Implementations§
Source§impl Encoder
impl Encoder
Sourcepub fn new(max_capacity: u64, huffman: bool) -> Self
pub fn new(max_capacity: u64, huffman: bool) -> Self
Creates an encoder bound to a decoder that advertised the given
max_capacity in SETTINGS_QPACK_MAX_TABLE_CAPACITY.
Sourcepub fn max_capacity(&self) -> u64
pub fn max_capacity(&self) -> u64
The maximum dynamic table capacity permitted by the decoder.
Sourcepub fn encode_section(
&mut self,
stream_id: u64,
headers: &[(Bytes, Bytes)],
) -> EncodedSection
pub fn encode_section( &mut self, stream_id: u64, headers: &[(Bytes, Bytes)], ) -> EncodedSection
Encodes headers for the field section on stream_id into an
encoded field section plus the encoder stream instructions the
decoder needs to process it.
The dynamic table is used only when the decoder allows a capacity of at least one entry (RFC 9204 Section 3.2.3): a maximum capacity below 32 bytes cannot hold any entry and disables the dynamic table.
Sourcepub fn set_capacity(&mut self, capacity: u64) -> Option<Bytes>
pub fn set_capacity(&mut self, capacity: u64) -> Option<Bytes>
Sets the dynamic table capacity (4.3.1), evicting as needed. Returns
the instruction, or None when the capacity is unchanged, exceeds
the decoder’s maximum, or the reduction would evict entries the
decoder still needs (RFC 9204 Section 2.1.1).
Sourcepub fn feed_decoder_stream(&mut self, buf: &[u8]) -> Result<(), QpackError>
pub fn feed_decoder_stream(&mut self, buf: &[u8]) -> Result<(), QpackError>
Processes the decoder stream instructions in buf. Section
Acknowledgments (4.4.1) free a field section’s references, Stream
Cancellations (4.4.2) free every reference of a cancelled stream,
and Insert Count Increments (4.4.3) raise the Known Received Count.
Only an Insert Count Increment (4.4.3) is a connection error: a zero increment, or one that advances past the number of inserts sent (RFC 9204 Section 2.1.4). A Section Acknowledgment or Stream Cancellation that matches no outstanding field section is benign — RFC 9204 Section 4.4 defines no error for it and a peer may send one for a section already acknowledged or cancelled — so it is ignored rather than closing the connection.