pub struct ChildStdin { /* private fields */ }
Expand description
A handle to a child process’s standard input (stdin).
This struct is used in the stdin
field on Child
.
When an instance of ChildStdin
is dropped, the ChildStdin
’s underlying
file handle will be closed. If the child process was blocked on input prior
to being dropped, it will become unblocked after dropping.
Trait Implementations§
1.63.0 · Source§impl AsFd for ChildStdin
Available on Unix only.
impl AsFd for ChildStdin
Source§fn as_fd(&self) -> BorrowedFd<'_>
fn as_fd(&self) -> BorrowedFd<'_>
1.63.0 · Source§impl AsHandle for ChildStdin
Available on Windows only.
impl AsHandle for ChildStdin
Source§fn as_handle(&self) -> BorrowedHandle<'_>
fn as_handle(&self) -> BorrowedHandle<'_>
1.2.0 · Source§impl AsRawFd for ChildStdin
Available on Unix only.
impl AsRawFd for ChildStdin
1.2.0 · Source§impl AsRawHandle for ChildStdin
Available on Windows only.
impl AsRawHandle for ChildStdin
Source§fn as_raw_handle(&self) -> RawHandle
fn as_raw_handle(&self) -> RawHandle
1.16.0 · Source§impl Debug for ChildStdin
impl Debug for ChildStdin
1.63.0 · Source§impl From<ChildStdin> for OwnedFd
Available on Unix only.
impl From<ChildStdin> for OwnedFd
Source§fn from(child_stdin: ChildStdin) -> OwnedFd
fn from(child_stdin: ChildStdin) -> OwnedFd
Takes ownership of a ChildStdin
’s file descriptor.
1.63.0 · Source§impl From<ChildStdin> for OwnedHandle
Available on Windows only.
impl From<ChildStdin> for OwnedHandle
Source§fn from(child_stdin: ChildStdin) -> OwnedHandle
fn from(child_stdin: ChildStdin) -> OwnedHandle
Takes ownership of a ChildStdin
’s file handle.
1.20.0 · Source§impl From<ChildStdin> for Stdio
impl From<ChildStdin> for Stdio
Source§fn from(child: ChildStdin) -> Stdio
fn from(child: ChildStdin) -> Stdio
Converts a ChildStdin
into a Stdio
.
§Examples
ChildStdin
will be converted to Stdio
using Stdio::from
under the hood.
use std::process::{Command, Stdio};
let reverse = Command::new("rev")
.stdin(Stdio::piped())
.spawn()
.expect("failed reverse command");
let _echo = Command::new("echo")
.arg("Hello, world!")
.stdout(reverse.stdin.unwrap()) // Converted into a Stdio here
.output()
.expect("failed echo command");
// "!dlrow ,olleH" echoed to console
1.74.0 · Source§impl From<OwnedFd> for ChildStdin
Available on Unix only.Creates a ChildStdin
from the provided OwnedFd
.
impl From<OwnedFd> for ChildStdin
Creates a ChildStdin
from the provided OwnedFd
.
The provided file descriptor must point to a pipe
with the CLOEXEC
flag set.
1.74.0 · Source§impl From<OwnedHandle> for ChildStdin
Available on Windows only.Creates a ChildStdin
from the provided OwnedHandle
.
impl From<OwnedHandle> for ChildStdin
Creates a ChildStdin
from the provided OwnedHandle
.
The provided handle must be asynchronous, as reading and writing from and to it is implemented using asynchronous APIs.
Source§fn from(handle: OwnedHandle) -> ChildStdin ⓘ
fn from(handle: OwnedHandle) -> ChildStdin ⓘ
1.4.0 · Source§impl IntoRawFd for ChildStdin
Available on Unix only.
impl IntoRawFd for ChildStdin
Source§fn into_raw_fd(self) -> RawFd
fn into_raw_fd(self) -> RawFd
1.4.0 · Source§impl IntoRawHandle for ChildStdin
Available on Windows only.
impl IntoRawHandle for ChildStdin
Source§fn into_raw_handle(self) -> RawHandle
fn into_raw_handle(self) -> RawHandle
1.48.0 · Source§impl Write for &ChildStdin
impl Write for &ChildStdin
Source§fn write(&mut self, buf: &[u8]) -> Result<usize>
fn write(&mut self, buf: &[u8]) -> Result<usize>
Source§fn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
can_vector
#69941)Source§fn flush(&mut self) -> Result<()>
fn flush(&mut self) -> Result<()>
1.0.0 · Source§fn write_all(&mut self, buf: &[u8]) -> Result<()>
fn write_all(&mut self, buf: &[u8]) -> Result<()>
Source§fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<()>
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<()>
write_all_vectored
#70436)1.0.0 · Source§impl Write for ChildStdin
impl Write for ChildStdin
Source§fn write(&mut self, buf: &[u8]) -> Result<usize>
fn write(&mut self, buf: &[u8]) -> Result<usize>
Source§fn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
can_vector
#69941)Source§fn flush(&mut self) -> Result<()>
fn flush(&mut self) -> Result<()>
1.0.0 · Source§fn write_all(&mut self, buf: &[u8]) -> Result<()>
fn write_all(&mut self, buf: &[u8]) -> Result<()>
Source§fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<()>
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<()>
write_all_vectored
#70436)