Struct edjx::stream::WriteStream
source · pub struct WriteStream { /* private fields */ }
Expand description
The WriteStream is used to stream data.
Implementations§
source§impl WriteStream
impl WriteStream
sourcepub fn write_chunk_text(&mut self, text: &str) -> Result<(), StreamError>
pub fn write_chunk_text(&mut self, text: &str) -> Result<(), StreamError>
Sends the given &str
chunk into the stream
sourcepub fn write_chunk_binary(&mut self, bytes: Vec<u8>) -> Result<(), StreamError>
pub fn write_chunk_binary(&mut self, bytes: Vec<u8>) -> Result<(), StreamError>
Sends the given Vec<u8>
chunk into the steam
sourcepub fn abort(&self) -> Result<(), StreamError>
pub fn abort(&self) -> Result<(), StreamError>
Aborts sending data and closes the stream.
This method abruptly ends the streaming.
Difference between WriteStream::close()
and WriteStream::abort()
when HTTP/1.1 is used for streaming:
WriteStream::close()
sends a terminating chunk of size zero to signalize the end of the streamWriteStream::abort()
stops streaming without sending the terminating chunk
Note that WriteStream::close()
is not available after WriteStream::abort()
is called.