Struct h3::server::RequestStream

source ·
pub struct RequestStream<S, B> { /* private fields */ }
Expand description

Manage request and response transfer for an incoming request

The RequestStream struct is used to send and/or receive information from the client.

Implementations§

source§

impl<S, B> RequestStream<S, B>where S: RecvStream,

source

pub async fn recv_data(&mut self) -> Result<Option<impl Buf>, Error>

Receive data sent from the client

source

pub async fn recv_trailers(&mut self) -> Result<Option<HeaderMap>, Error>

Receive an optional set of trailers for the request

source

pub fn stop_sending(&mut self, error_code: Code)

Tell the peer to stop sending into the underlying QUIC stream

source§

impl<S, B> RequestStream<S, B>where S: SendStream<B>, B: Buf,

source

pub async fn send_response(&mut self, resp: Response<()>) -> Result<(), Error>

Send the HTTP/3 response

This should be called before trying to send any data with RequestStream::send_data.

source

pub async fn send_data(&mut self, buf: B) -> Result<(), Error>

Send some data on the response body.

source

pub fn stop_stream(&mut self, error_code: Code)

Stop a stream with an error code

The code can be Code::H3_NO_ERROR.

source

pub async fn send_trailers(&mut self, trailers: HeaderMap) -> Result<(), Error>

Send a set of trailers to end the response.

Either RequestStream::finish or RequestStream::send_trailers must be called to finalize a request.

source

pub async fn finish(&mut self) -> Result<(), Error>

End the response without trailers.

Either RequestStream::finish or RequestStream::send_trailers must be called to finalize a request.

source§

impl<S, B> RequestStream<S, B>where S: BidiStream<B>, B: Buf,

source

pub fn split( self ) -> (RequestStream<S::SendStream, B>, RequestStream<S::RecvStream, B>)

Splits the Request-Stream into send and receive. This can be used the send and receive data on different tasks.

Auto Trait Implementations§

§

impl<S, B> !RefUnwindSafe for RequestStream<S, B>

§

impl<S, B> Send for RequestStream<S, B>where B: Send, S: Send,

§

impl<S, B> Sync for RequestStream<S, B>where B: Sync, S: Sync,

§

impl<S, B> Unpin for RequestStream<S, B>where B: Unpin, S: Unpin,

§

impl<S, B> !UnwindSafe for RequestStream<S, B>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

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

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

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 Twhere U: From<T>,

const: unstable · 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 Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

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
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

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