pub struct ChildStdin {
inner: AnonPipe,
}
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.
Fields§
§inner: AnonPipe
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
Source§impl CopyWrite for ChildStdin
impl CopyWrite for ChildStdin
Source§fn properties(&self) -> CopyParams
fn properties(&self) -> CopyParams
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 ⓘ
Source§impl FromInner<AnonPipe> for ChildStdin
impl FromInner<AnonPipe> for ChildStdin
fn from_inner(pipe: AnonPipe) -> ChildStdin ⓘ
Source§impl IntoInner<AnonPipe> for ChildStdin
impl IntoInner<AnonPipe> for ChildStdin
fn into_inner(self) -> AnonPipe
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)Auto Trait Implementations§
impl Freeze for ChildStdin
impl RefUnwindSafe for ChildStdin
impl Send for ChildStdin
impl Sync for ChildStdin
impl Unpin for ChildStdin
impl UnwindSafe for ChildStdin
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> SizedTypeProperties for T
impl<T> SizedTypeProperties for T
Source§#[doc(hidden)] const IS_ZST: bool = _
#[doc(hidden)] const IS_ZST: bool = _
sized_type_properties
)Source§#[doc(hidden)] const LAYOUT: Layout = _
#[doc(hidden)] const LAYOUT: Layout = _
sized_type_properties
)Source§#[doc(hidden)] const MAX_SLICE_LEN: usize = _
#[doc(hidden)] const MAX_SLICE_LEN: usize = _
sized_type_properties
)[Self]
. Read more