MCPcopy Create free account
hub / github.com/bytecodealliance/wstd / flush

Method flush

src/io/streams.rs:307–320  ·  view source on GitHub ↗

Asyncronously flush the output stream. Initiates a flush, and then awaits until the flush is complete and the output stream is ready for writing again. This method is the same as [`AsyncWrite::flush`], but doesn't require a `&mut self`. Fails with a `std::io::Error` indicating either an error returned by the stream flush, using the debug string provided by the WASI error, or else that the stream

(&self)

Source from the content-addressed store, hash-verified

305 /// or else that the stream is closed, indicated by
306 /// `std::io::ErrorKind::ConnectionReset`.
307 pub async fn flush(&self) -> std::io::Result<()> {
308 match self.stream.flush() {
309 Ok(()) => {
310 self.ready().await;
311 Ok(())
312 }
313 Err(StreamError::Closed) => {
314 Err(std::io::Error::from(std::io::ErrorKind::ConnectionReset))
315 }
316 Err(StreamError::LastOperationFailed(err)) => {
317 Err(std::io::Error::other(err.to_debug_string()))
318 }
319 }
320 }
321}
322
323impl AsyncWrite for AsyncOutputStream {

Callers 1

tcp_stream_clientFunction · 0.45

Calls 1

readyMethod · 0.45

Tested by 1

tcp_stream_clientFunction · 0.36