pub struct ChildStdin { /* private fields */ }
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.
impl AsFd for ChildStdinAvailable on Unix only.
fn as_fd(&self) -> BorrowedFd<'_>
target_os=trusty or WASI or target_os=motor only.impl AsHandle for ChildStdinAvailable on Windows only.
impl AsRawFd for ChildStdinAvailable on Unix only.
fn as_raw_fd(&self) -> RawFd
target_os=trusty or WASI or target_os=motor only.impl AsRawHandle for ChildStdinAvailable on Windows only.
impl Debug for ChildStdin
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl From<ChildStdin> for OwnedFdAvailable on Unix only.
fn from(child_stdin: ChildStdin) -> OwnedFd
Takes ownership of a ChildStdin’s file descriptor.
impl From<ChildStdin> for OwnedHandleAvailable on Windows only.
fn from(child_stdin: ChildStdin) -> OwnedHandle
Takes ownership of a ChildStdin’s file handle.
impl From<ChildStdin> for Stdio
fn from(child: ChildStdin) -> Stdio
Converts a ChildStdin into a Stdio.
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 consoleimpl From<OwnedFd> for ChildStdinAvailable on Unix only.Creates a ChildStdin from the provided OwnedFd.
The provided file descriptor must point to a pipe with the CLOEXEC flag set.
fn from(fd: OwnedFd) -> ChildStdin ⓘ
impl From<OwnedHandle> for ChildStdinAvailable on Windows only.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.
fn from(handle: OwnedHandle) -> ChildStdin ⓘ
impl IntoRawFd for ChildStdinAvailable on Unix only.
fn into_raw_fd(self) -> RawFd
target_os=trusty or WASI or target_os=motor only.impl IntoRawHandle for ChildStdinAvailable on Windows only.
fn into_raw_handle(self) -> RawHandle
impl Write for &ChildStdin
fn write(&mut self, buf: &[u8]) -> Result<usize>
fn write_vectored(&mut self, bufs: &[IoSlice<'_>]) -> Result<usize>
fn is_write_vectored(&self) -> bool
can_vector #69941)
fn flush(&mut self) -> Result<()>
fn write_all(&mut self, buf: &[u8]) -> Result<()>
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<()>
write_all_vectored #70436)
fn write_fmt(&mut self, args: Arguments<'_>) -> Result<()>
fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,Write. Read more
impl Write for ChildStdin
fn write(&mut self, buf: &[u8]) -> Result<usize>
fn write_vectored(&mut self, bufs: &[IoSlice<'_>]) -> Result<usize>
fn is_write_vectored(&self) -> bool
can_vector #69941)
fn flush(&mut self) -> Result<()>
fn write_all(&mut self, buf: &[u8]) -> Result<()>
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<()>
write_all_vectored #70436)
fn write_fmt(&mut self, args: Arguments<'_>) -> Result<()>
fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,Write. Read more
impl Freeze for ChildStdin
impl RefUnwindSafe for ChildStdin
impl Send for ChildStdin
impl Sync for ChildStdin
impl Unpin for ChildStdin
impl UnwindSafe for ChildStdin
impl<T> Any for Twhere
T: 'static + ?Sized,impl<T> Borrow<T> for Twhere
T: ?Sized,impl<T> BorrowMut<T> for Twhere
T: ?Sized,impl<T> From<T> for T
fn from(t: T) -> T
Returns the argument unchanged.
impl<T, U> Into<U> for Twhere
U: From<T>,fn into(self) -> U
Calls U::from(self).
That is, this conversion is whatever the implementation of From<T> for U chooses to do.
impl<T, U> TryFrom<U> for Twhere
U: Into<T>,type Error = Infallible
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto<U> for Twhere
U: TryFrom<T>,
© 2010 The Rust Project Developers
Licensed under the Apache License, Version 2.0 or the MIT license, at your option.
https://doc.rust-lang.org/std/process/struct.ChildStdin.html