Struct std::process::ChildStdin
1.0.0 · source · [−]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
impl AsFd for ChildStdin
source Available on Unix only.
impl AsFd for ChildStdin
sourceimpl AsHandle for ChildStdin
source Available on Windows only.
impl AsHandle for ChildStdin
sourceimpl AsRawFd for ChildStdin
1.2.0 · source Available on Unix only.
impl AsRawFd for ChildStdin
1.2.0 · sourceimpl AsRawHandle for ChildStdin
1.2.0 · source Available on Windows only.
impl AsRawHandle for ChildStdin
1.2.0 · sourcefn as_raw_handle(&self) -> RawHandle
source
fn as_raw_handle(&self) -> RawHandle
sourceExtracts the raw handle. Read more
impl Debug for ChildStdin
1.16.0 · source
impl Debug for ChildStdin
1.16.0 · sourceimpl From<ChildStdin> for OwnedFd
source Available on Unix only.
impl From<ChildStdin> for OwnedFd
sourcefn from(child_stdin: ChildStdin) -> OwnedFd
source
fn from(child_stdin: ChildStdin) -> OwnedFd
sourceConverts to this type from the input type.
impl From<ChildStdin> for OwnedHandle
source Available on Windows only.
impl From<ChildStdin> for OwnedHandle
sourcefn from(child_stdin: ChildStdin) -> OwnedHandle
source
fn from(child_stdin: ChildStdin) -> OwnedHandle
sourceConverts to this type from the input type.
impl From<ChildStdin> for Stdio
1.20.0 · source
impl From<ChildStdin> for Stdio
1.20.0 · sourcefn from(child: ChildStdin) -> Stdio
source
fn from(child: ChildStdin) -> Stdio
sourceConverts 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 consoleRunimpl IntoRawFd for ChildStdin
1.4.0 · source Available on Unix only.
impl IntoRawFd for ChildStdin
1.4.0 · sourcefn into_raw_fd(self) -> RawFd
source
fn into_raw_fd(self) -> RawFd
sourceConsumes this object, returning the raw underlying file descriptor. Read more
impl IntoRawHandle for ChildStdin
1.4.0 · source Available on Windows only.
impl IntoRawHandle for ChildStdin
1.4.0 · sourcefn into_raw_handle(self) -> RawHandle
source
fn into_raw_handle(self) -> RawHandle
sourceConsumes this object, returning the raw underlying handle. Read more
impl Write for ChildStdin
source
impl Write for ChildStdin
sourcefn write(&mut self, buf: &[u8]) -> Result<usize>
source
fn write(&mut self, buf: &[u8]) -> Result<usize>
sourceWrite a buffer into this writer, returning how many bytes were written. Read more
fn is_write_vectored(&self) -> bool
source
fn is_write_vectored(&self) -> bool
sourceDetermines if this Writer has an efficient write_vectored
implementation. Read more
fn flush(&mut self) -> Result<()>
source
fn flush(&mut self) -> Result<()>
sourceFlush this output stream, ensuring that all intermediately buffered contents reach their destination. Read more
fn write_all(&mut self, buf: &[u8]) -> Result<()>
source
fn write_all(&mut self, buf: &[u8]) -> Result<()>
sourceAttempts to write an entire buffer into this writer. Read more
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<()>
source
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<()>
sourceAttempts to write multiple buffers into this writer. Read more
impl Write for &ChildStdin
1.48.0 · source
impl Write for &ChildStdin
1.48.0 · sourcefn write(&mut self, buf: &[u8]) -> Result<usize>
source
fn write(&mut self, buf: &[u8]) -> Result<usize>
sourceWrite a buffer into this writer, returning how many bytes were written. Read more
fn is_write_vectored(&self) -> bool
source
fn is_write_vectored(&self) -> bool
sourceDetermines if this Writer has an efficient write_vectored
implementation. Read more
fn flush(&mut self) -> Result<()>
source
fn flush(&mut self) -> Result<()>
sourceFlush this output stream, ensuring that all intermediately buffered contents reach their destination. Read more
fn write_all(&mut self, buf: &[u8]) -> Result<()>
source
fn write_all(&mut self, buf: &[u8]) -> Result<()>
sourceAttempts to write an entire buffer into this writer. Read more
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<()>
source
fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<()>
sourceAttempts to write multiple buffers into this writer. Read more
Auto Trait Implementations
impl RefUnwindSafe for ChildStdin
impl Send for ChildStdin
impl Sync for ChildStdin
impl Unpin for ChildStdin
impl UnwindSafe for ChildStdin
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
source
impl<T> BorrowMut<T> for T where
T: ?Sized,
sourcefn borrow_mut(&mut self) -> &mut T
const: unstable · source
fn borrow_mut(&mut self) -> &mut T
const: unstable · sourceMutably borrows from an owned value. Read more