Enum kvarn::application::ResponseBodyPipe
source · pub enum ResponseBodyPipe {
Http1(Arc<Mutex<Encryption>>),
Http2(SendStream<Bytes>, H2SendResponse),
Http3(RequestStream<SendStream<Bytes>, Bytes>),
}
Expand description
A pipe to send a body after the Response
is sent by
ResponsePipe::send_response
.
The AsyncWriteExt::shutdown
does nothing, and will immediately return with Ok(())
Variants§
Http1(Arc<Mutex<Encryption>>)
HTTP/1 pipe
Http2(SendStream<Bytes>, H2SendResponse)
Available on crate feature
http2
only.HTTP/2 pipe
Http3(RequestStream<SendStream<Bytes>, Bytes>)
Available on crate feature
http3
only.HTTP/3 pipe
Implementations§
source§impl ResponseBodyPipe
impl ResponseBodyPipe
sourcepub async fn send(&mut self, data: Bytes) -> Result<(), Error>
pub async fn send(&mut self, data: Bytes) -> Result<(), Error>
Sends data
as the body.
Errors
Passes any errors from writing to the stream.
See AsyncWriteExt::write_all()
and h2::SendStream::send_data()
.
sourcepub fn push_request(
&mut self,
request: Request<()>
) -> Result<PushedResponsePipe, Error>
pub fn push_request( &mut self, request: Request<()> ) -> Result<PushedResponsePipe, Error>
Pushes request
to client.
Errors
If you try to push if self
is ResponsePipe::Http1
, an Error::UnsupportedPush
is returned.
Returns errors from h2::server::SendResponse::push_request()
.
sourcepub async fn close(&mut self) -> Result<(), Error>
pub async fn close(&mut self) -> Result<(), Error>
Closes the pipe.
Errors
Passes any errors emitted when closing the writer.
See AsyncWriteExt::flush()
and h2::SendStream::send_data()
.