Skip to main content

FrameReader

Struct FrameReader 

Source
pub struct FrameReader { /* private fields */ }
Expand description

A FrameDecoder wired to a QUIC receive stream.

All of the awaiting happens in one place – [quinn::RecvStream::read_chunk] – and every byte it produces is accounted for in the decoder before this returns, which is what makes Self::next cancel-safe. tunnel::udp reads request streams inside a select! with a timeout, so a dropped read future must never lose a parsed frame header.

Implementations§

Source§

impl FrameReader

Source

pub fn new(recv: RecvStream, budget: Arc<BufferBudget>) -> Self

A reader for a stream on which every frame type this server parses may appear.

That is the peer’s control stream: RFC 9114 §6.2.1 makes it the stream SETTINGS, GOAWAY, CANCEL_PUSH and MAX_PUSH_ID belong on, and which of them may arrive when is super::connection’s to judge rather than the framing layer’s. A request stream is read through the crate-internal on_request_stream instead, where those four – and PUSH_PROMISE – are refused from the frame header.

It is also what a client wants for a response stream, which is why this is the constructor that stayed plain: the suite’s client (tests/common/h3client.rs) is built on this module.

budget is the connection’s, not this stream’s: see BufferBudget.

Source

pub fn stop(&mut self, code: Code)

Asks the peer to stop sending on this stream.

Source

pub async fn next(&mut self) -> Result<Option<Item>, Error>

Reads the next item, or None once the peer has finished cleanly.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more