ChildStdout in std::process - Rust (original) (raw)
Struct ChildStdout
1.0.0 · Source
pub struct ChildStdout { /* private fields */ }
Expand description
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.
Available on Unix only.
Available on Windows only.
Available on Unix only.
Available on Windows only.
Available on Unix only.
Available on Windows only.
Converts a ChildStdout into a Stdio.
§Examples
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");
Available on Unix only.
Creates a ChildStdout
from the provided OwnedFd
.
The provided file descriptor must point to a pipe with the CLOEXEC
flag set.
Converts to this type from the input type.
Available 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.
Converts to this type from the input type.
Available on Unix only.
Consumes this object, returning the raw underlying file descriptor. Read more
Available on Windows only.
Pull some bytes from this source into the specified buffer, returning how many bytes were read. Read more
🔬This is a nightly-only experimental API. (read_buf
#78485)
Pull some bytes from this source into the specified buffer. Read more
Like read
, except that it reads into a slice of buffers. Read more
🔬This is a nightly-only experimental API. (can_vector
#69941)
Determines if this Read
er has an efficient read_vectored
implementation. Read more
Reads all bytes until EOF in this source, placing them into buf
. Read more
Reads all bytes until EOF in this source, appending them to buf
. Read more
Reads the exact number of bytes required to fill buf
. Read more
🔬This is a nightly-only experimental API. (read_buf
#78485)
Reads the exact number of bytes required to fill cursor
. Read more
Creates a “by reference” adaptor for this instance of Read
. Read more
Transforms this Read
instance to an Iterator over its bytes. Read more
Creates an adapter which will chain this stream with another. Read more
Creates an adapter which will read at most limit
bytes from it. Read more