Struct std::process::ChildStdout
1.0.0 · source · pub struct ChildStdout { /* private fields */ }
Expand description
Trait Implementations§
1.63.0 · source§impl AsFd for ChildStdout
Available on Unix only.
impl AsFd for ChildStdout
Available on Unix only.
source§fn as_fd(&self) -> BorrowedFd<'_>
fn as_fd(&self) -> BorrowedFd<'_>
借用文件描述符。 Read more
1.63.0 · source§impl AsHandle for ChildStdout
Available on Windows only.
impl AsHandle for ChildStdout
Available on Windows only.
source§fn as_handle(&self) -> BorrowedHandle<'_>
fn as_handle(&self) -> BorrowedHandle<'_>
借用句柄。 Read more
1.2.0 · source§impl AsRawFd for ChildStdout
Available on Unix only.
impl AsRawFd for ChildStdout
Available on Unix only.
1.2.0 · source§impl AsRawHandle for ChildStdout
Available on Windows only.
impl AsRawHandle for ChildStdout
Available on Windows only.
source§fn as_raw_handle(&self) -> RawHandle
fn as_raw_handle(&self) -> RawHandle
提取原始句柄。 Read more
1.16.0 · source§impl Debug for ChildStdout
impl Debug for ChildStdout
1.63.0 · source§impl From<ChildStdout> for OwnedFd
Available on Unix only.
impl From<ChildStdout> for OwnedFd
Available on Unix only.
source§fn from(child_stdout: ChildStdout) -> OwnedFd
fn from(child_stdout: ChildStdout) -> OwnedFd
从输入类型转换为此类型。
1.63.0 · source§impl From<ChildStdout> for OwnedHandle
Available on Windows only.
impl From<ChildStdout> for OwnedHandle
Available on Windows only.
source§fn from(child_stdout: ChildStdout) -> OwnedHandle
fn from(child_stdout: ChildStdout) -> OwnedHandle
从输入类型转换为此类型。
1.20.0 · source§impl From<ChildStdout> for Stdio
impl From<ChildStdout> for Stdio
source§fn from(child: ChildStdout) -> Stdio
fn from(child: ChildStdout) -> Stdio
将 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");
Run1.4.0 · source§impl IntoRawFd for ChildStdout
Available on Unix only.
impl IntoRawFd for ChildStdout
Available on Unix only.
source§fn into_raw_fd(self) -> RawFd
fn into_raw_fd(self) -> RawFd
消费这个对象,返回原始的底层文件描述符。 Read more
1.4.0 · source§impl IntoRawHandle for ChildStdout
Available on Windows only.
impl IntoRawHandle for ChildStdout
Available on Windows only.
source§fn into_raw_handle(self) -> RawHandle
fn into_raw_handle(self) -> RawHandle
消耗此对象,返回原始底层句柄。 Read more
source§impl Read for ChildStdout
impl Read for ChildStdout
source§fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> Result<()>
fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> Result<()>
🔬This is a nightly-only experimental API. (
read_buf
#78485)从此源中提取一些字节到指定的缓冲区中。 Read more
source§fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize>
fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize>
与
read
相似,不同之处在于它读入缓冲区的一部分。 Read moresource§fn is_read_vectored(&self) -> bool
fn is_read_vectored(&self) -> bool
🔬This is a nightly-only experimental API. (
can_vector
#69941)source§fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize>
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize>
读取所有字节,直到此源中的 EOF 为止,然后将它们放入
buf
。 Read moresource§fn read_to_string(&mut self, buf: &mut String) -> Result<usize>
fn read_to_string(&mut self, buf: &mut String) -> Result<usize>
读取这个源中的所有字节,直到 EOF 为止,然后将它们追加到
buf
。 Read moresource§fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<()>
fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<()>
🔬This is a nightly-only experimental API. (
read_buf
#78485)读取填充
cursor
所需的确切字节数。 Read moresource§fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
fn by_ref(&mut self) -> &mut Selfwhere Self: Sized,
为这个
Read
实例创建一个 “by reference” 适配器。 Read more