pub struct ChildStdout { /* private fields */ }
A handle to a child process’s standard output (stdout).
This struct is used in the stdout field on Child.
When an instance of ChildStdout is dropped, the ChildStdout’s underlying file handle will be closed.
impl AsFd for ChildStdoutAvailable on Unix only.
fn as_fd(&self) -> BorrowedFd<'_>
target_os=trusty or WASI or target_os=motor only.impl AsHandle for ChildStdoutAvailable on Windows only.
impl AsRawFd for ChildStdoutAvailable on Unix only.
fn as_raw_fd(&self) -> RawFd
target_os=trusty or WASI or target_os=motor only.impl AsRawHandle for ChildStdoutAvailable on Windows only.
impl Debug for ChildStdout
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl From<ChildStdout> for OwnedFdAvailable on Unix only.
fn from(child_stdout: ChildStdout) -> OwnedFd
Takes ownership of a ChildStdout’s file descriptor.
impl From<ChildStdout> for OwnedHandleAvailable on Windows only.
fn from(child_stdout: ChildStdout) -> OwnedHandle
Takes ownership of a ChildStdout’s file handle.
impl From<ChildStdout> for Stdio
fn from(child: ChildStdout) -> Stdio
Converts a ChildStdout into a Stdio.
ChildStdout will be converted to Stdio using Stdio::from under the hood.
use std::process::{Command, Stdio};
let hello = Command::new("echo")
.arg("Hello, world!")
.stdout(Stdio::piped())
.spawn()
.expect("failed echo command");
let reverse = Command::new("rev")
.stdin(hello.stdout.unwrap()) // Converted into a Stdio here
.output()
.expect("failed reverse command");
assert_eq!(reverse.stdout, b"!dlrow ,olleH\n");impl From<OwnedFd> for ChildStdoutAvailable on Unix only.Creates a ChildStdout from the provided OwnedFd.
The provided file descriptor must point to a pipe with the CLOEXEC flag set.
fn from(fd: OwnedFd) -> ChildStdout ⓘ
impl From<OwnedHandle> for ChildStdoutAvailable on Windows only.Creates a ChildStdout 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) -> ChildStdout ⓘ
impl IntoRawFd for ChildStdoutAvailable on Unix only.
fn into_raw_fd(self) -> RawFd
target_os=trusty or WASI or target_os=motor only.impl IntoRawHandle for ChildStdoutAvailable on Windows only.
fn into_raw_handle(self) -> RawHandle
impl Read for ChildStdout
fn read(&mut self, buf: &mut [u8]) -> Result<usize>
fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> Result<()>
read_buf #78485)
fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize>
read, except that it reads into a slice of buffers. Read more
fn is_read_vectored(&self) -> bool
can_vector #69941)
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize>
buf. Read more
fn read_to_string(&mut self, buf: &mut String) -> Result<usize>
buf. Read more
fn read_exact(&mut self, buf: &mut [u8]) -> Result<()>
buf. Read more
fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<()>
read_buf #78485)
cursor. Read more
fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,Read. Read more
fn bytes(self) -> Bytes<Self> ⓘwhere
Self: Sized,fn chain<R: Read>(self, next: R) -> Chain<Self, R> ⓘwhere
Self: Sized,fn take(self, limit: u64) -> Take<Self> ⓘwhere
Self: Sized,limit bytes from it. Read more
fn read_array<const N: usize>(&mut self) -> Result<[u8; N]>where
Self: Sized,read_array #148848)
impl Freeze for ChildStdout
impl RefUnwindSafe for ChildStdout
impl Send for ChildStdout
impl Sync for ChildStdout
impl Unpin for ChildStdout
impl UnwindSafe for ChildStdout
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.ChildStdout.html