pub struct SendStream { /* private fields */ }Expand description
Send some body data to a remote peer.
Obtained either via a client::SendRequest or a server::SendResponse.
Implementations§
Source§impl SendStream
impl SendStream
Sourcepub async fn send_data(
&mut self,
data: &[u8],
end_of_body: bool,
) -> Result<(), Error>
pub async fn send_data( &mut self, data: &[u8], end_of_body: bool, ) -> Result<(), Error>
Send one chunk of data. Use end_of_body to signal end of data.
When the body is constrained by a content-length header, this will only accept
the amount of bytes specified in the header. If there is too much data, the
function will error with a Error::User.
For transfer-encoding: chunked, call to this function corresponds to one “chunk”.
Sourcepub async fn send_data_owned(
&mut self,
data: Vec<u8>,
end_of_body: bool,
) -> Result<(), Error>
pub async fn send_data_owned( &mut self, data: Vec<u8>, end_of_body: bool, ) -> Result<(), Error>
Send one chunk of data. Use end_of_body to signal end of data.
This is an optimization which together with a content-length shortcuts
some unnecessary copying of data.
When the body is constrained by a content-length header, this will only accept
the amount of bytes specified in the header. If there is too much data, the
function will error with a Error::User.
For transfer-encoding: chunked, call to this function corresponds to one “chunk”.