Struct Decoder
pub struct Decoder { /* private fields */ }http-backend and http and std only.Expand description
A stateful QPACK decoder for one connection.
Implementations§
§impl Decoder
impl Decoder
pub fn new(config: DecoderConfig) -> Decoder
pub fn new(config: DecoderConfig) -> Decoder
Create a decoder with the given limits.
pub fn insert_count(&self) -> u64
pub fn insert_count(&self) -> u64
The decoder’s current dynamic-table insert count.
pub fn blocked_stream_count(&self) -> usize
pub fn blocked_stream_count(&self) -> usize
The number of currently blocked streams.
pub fn take_decoder_stream(&mut self) -> Bytes
pub fn take_decoder_stream(&mut self) -> Bytes
Take the queued decoder-stream bytes to send to the peer, leaving the queue empty.
pub fn feed_encoder_stream(&mut self, input: &[u8]) -> Result<(), QpackError>
pub fn feed_encoder_stream(&mut self, input: &[u8]) -> Result<(), QpackError>
Feed bytes received on the peer’s encoder stream, applying every complete instruction.
Retains a trailing partial instruction for the next call (transactional), and emits Insert
Count Increment for entries inserted. Any newly unblocked streams should then be collected
with Decoder::resume_blocked. OutputBlocked consumes no input: drain the decoder
stream and retry. If the queue is already empty, split the input into smaller batches:
reservation bounds the increment by the input byte count. Other errors are fatal connection
errors; do not retry them.
pub fn decode_field_section(
&mut self,
stream_id: u64,
encoded: Bytes,
) -> Result<Option<Vec<FieldPair>>, QpackError>
pub fn decode_field_section( &mut self, stream_id: u64, encoded: Bytes, ) -> Result<Option<Vec<FieldPair>>, QpackError>
Decode a complete encoded field section received on stream stream_id.
The full section must be buffered by the caller (the frame layer bounds its length first).
Returns Ok(Some(fields)) when it decodes immediately, or Ok(None) when it is blocked on
the Required Insert Count, in which case it is retained (subject to the blocked budget) and
returned later by Decoder::resume_blocked.
Immediately decoded literals share the supplied allocation. Queued sections are compacted
to avoid retaining an arbitrarily large backing allocation through a small slice. Retain a
cheap Bytes clone until success: OutputBlocked leaves state unchanged, so drain and retry.
On FieldSectionLimit, queued sections for this stream are released. The caller must reset
the stream and call Decoder::cancel_stream (draining and retrying if necessary) to notify
the peer and release its references.
pub fn resume_blocked(
&mut self,
) -> Vec<(u64, Result<Vec<FieldPair>, QpackError>)>
pub fn resume_blocked( &mut self, ) -> Vec<(u64, Result<Vec<FieldPair>, QpackError>)>
Decode and remove blocked sections whose Required Insert Count is now satisfied.
Each stream’s sections are resumed front-first and only while the front is ready, so a
stream’s sections are never delivered out of order. A decode failure is reported per stream.
OutputBlocked leaves the section queued; drain output before resuming again. A
FieldSectionLimit releases all queued sections for that stream; reset it and call
Decoder::cancel_stream to release the peer’s references.
pub fn cancel_stream(&mut self, stream_id: u64) -> Result<(), QpackError>
pub fn cancel_stream(&mut self, stream_id: u64) -> Result<(), QpackError>
Cancel a stream: drop any blocked sections and emit Stream Cancellation (RFC 9204 §4.4.2).
OutputBlocked leaves blocked sections intact; drain output and retry.
Auto Trait Implementations§
impl Freeze for Decoder
impl RefUnwindSafe for Decoder
impl Send for Decoder
impl Sync for Decoder
impl Unpin for Decoder
impl UnsafeUnpin for Decoder
impl UnwindSafe for Decoder
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a rama_grpc::Request§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§fn and<P, B, E>(self, other: P) -> And<T, P>
fn and<P, B, E>(self, other: P) -> And<T, P>
Policy that returns Action::Follow only if self and other return
Action::Follow. Read more