W3cubDocs

/Rust

Struct std::process::ChildStdout

pub struct ChildStdout { /* fields omitted */ }

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.

Trait Implementations

impl AsRawFd for ChildStdout[src]1.2.0

impl AsRawHandle for ChildStdout[src]1.2.0

impl Debug for ChildStdout[src]1.16.0

impl From<ChildStdout> for Stdio[src]1.20.0

fn from(child: ChildStdout) -> Stdio[src]

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

impl IntoRawFd for ChildStdout[src]1.4.0

impl IntoRawHandle for ChildStdout[src]1.4.0

impl Read for ChildStdout[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized, 
[src]

impl<T> Borrow<T> for T where
    T: ?Sized, 
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

© 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