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.

1.63.0 · Source§

Available on Unix only.

1.63.0 · Source§

Available on Windows only.

1.2.0 · Source§

Available on Unix only.

1.2.0 · Source§

Available on Windows only.

1.16.0 · Source§

1.63.0 · Source§

Available on Unix only.

1.63.0 · Source§

Available on Windows only.

1.20.0 · Source§

Source§

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");

1.74.0 · Source§

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.

Source§

Converts to this type from the input type.

1.74.0 · Source§

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.

Source§

Converts to this type from the input type.

1.4.0 · Source§

Available on Unix only.

Source§

Consumes this object, returning the raw underlying file descriptor. Read more

1.4.0 · Source§

Available on Windows only.

1.0.0 · Source§

Source§

Pull some bytes from this source into the specified buffer, returning how many bytes were read. Read more

Source§

🔬This is a nightly-only experimental API. (read_buf #78485)

Pull some bytes from this source into the specified buffer. Read more

Source§

Like read, except that it reads into a slice of buffers. Read more

Source§

🔬This is a nightly-only experimental API. (can_vector #69941)

Determines if this Reader has an efficient read_vectoredimplementation. Read more

Source§

Reads all bytes until EOF in this source, placing them into buf. Read more

1.0.0 · Source§

Reads all bytes until EOF in this source, appending them to buf. Read more

1.6.0 · Source§

Reads the exact number of bytes required to fill buf. Read more

Source§

🔬This is a nightly-only experimental API. (read_buf #78485)

Reads the exact number of bytes required to fill cursor. Read more

1.0.0 · Source§

Creates a “by reference” adaptor for this instance of Read. Read more

1.0.0 · Source§

Transforms this Read instance to an Iterator over its bytes. Read more

1.0.0 · Source§

Creates an adapter which will chain this stream with another. Read more

1.0.0 · Source§

Creates an adapter which will read at most limit bytes from it. Read more

§

§

§

§

§

§