Struct std::process::ChildStdout1.0.0[][src]

pub struct ChildStdout { /* fields omitted */ }
Expand description

子进程的标准输出 (stdout) 的句柄。

该结构体用于 Childstdout 字段中。

ChildStdout 的实例是 dropped 时,ChildStdout 的基础文件句柄将关闭。

Trait Implementations

This is supported on Unix only.

提取原始文件描述符。 Read more

This is supported on Windows only.

提取原始句柄,无需任何所有权。

使用给定的格式化程序格式化该值。 Read more

ChildStdout 转换为 Stdio

Examples

ChildStdout 将在引擎盖下使用 Stdio::from 转换为 Stdio

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())  // 在此处转换为 Stdio
    .output()
    .expect("failed reverse command");

assert_eq!(reverse.stdout, b"!dlrow ,olleH\n");
Run
This is supported on Unix only.

使用此 object,返回原始基础文件描述符。 Read more

This is supported on Windows only.

消费此 object,返回原始基础句柄。 Read more

从该源中提取一些字节到指定的缓冲区中,返回读取的字节数。 Read more

read 相似,不同之处在于它读入缓冲区的一部分。 Read more

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

确定此 Read 是否具有有效的 read_vectored 实现。 Read more

🔬 This is a nightly-only experimental API. (read_initializer #42788)

确定该 Reader 是否可以与未初始化内存的缓冲区一起使用。 Read more

读取所有字节,直到此源中的 EOF 为止,然后将它们放入 bufRead more

读取所有字节,直到该源中的 EOF 为止,然后将它们附加到 bufRead more

读取填充 buf 所需的确切字节数。 Read more

为此 Read 实例创建 “by reference” 适配器。 Read more

将此 Read 实例的字节数转换为 IteratorRead more

创建一个适配器,它将将此流与另一个流链接。 Read more

创建一个适配器,该适配器最多可以从中读取 limit 字节。 Read more

Auto Trait Implementations

Blanket Implementations

获取 selfTypeIdRead more

从拥有的值中一成不变地借用。 Read more

从拥有的值中借用。 Read more

执行转换。

执行转换。

发生转换错误时返回的类型。

执行转换。

发生转换错误时返回的类型。

执行转换。