pub struct OwnedWriteHalf { /* private fields */ }tokio only.Expand description
Owned input half returned by Session::into_parts.
Bytes written here become console input for the child, exactly as if they
had been typed: line-oriented programs expect \r\n, not \n.
AsyncWriteExt::flush is a no-op: writes go straight to the pipe, and
there is no user-space buffer to push.
§Dropping — or shutting down — this half ends the session
Closing this half is not a polite “no more input” signal. It closes conin
and requests pseudoconsole close, which sends a close event to every
attached client. A child that is still running is therefore terminated
with exit code 0xC000013A (STATUS_CONTROL_C_EXIT) and loses any output
it had not written yet. Hold on to this half until the child has exited —
or close it deliberately to end a session that ignores everything else.
AsyncWriteExt::shutdown is that deliberate close: it never blocks, it
cancels a write still in flight rather than flushing it, and it makes
later writes fail with io::ErrorKind::BrokenPipe; shutting down again
is a no-op. Dropping this half closes the pipe the same way. One caveat:
with an overlapped write in flight, the OS handle closes only once the
runtime’s I/O driver has retired the cancelled operation, so the console
host observes the close after the driver’s next poll — one poll, not an
unbounded wait for the host to drain the pipe.
Trait Implementations§
Source§impl AsyncWrite for OwnedWriteHalf
impl AsyncWrite for OwnedWriteHalf
Source§fn poll_write(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
buf: &[u8],
) -> Poll<Result<usize>>
fn poll_write( self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &[u8], ) -> Poll<Result<usize>>
buf into the object. Read moreSource§fn poll_flush(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<Result<()>>
fn poll_flush(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<Result<()>>
Source§fn poll_shutdown(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>
fn poll_shutdown(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>
Source§fn poll_write_vectored(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
bufs: &[IoSlice<'_>],
) -> Poll<Result<usize, Error>>
fn poll_write_vectored( self: Pin<&mut Self>, cx: &mut Context<'_>, bufs: &[IoSlice<'_>], ) -> Poll<Result<usize, Error>>
poll_write, except that it writes from a slice of buffers. Read moreSource§fn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
poll_write_vectored
implementation. Read more