Struct std::process::ChildStderr

1.0.0 · source ·
pub struct ChildStderr { /* private fields */ }
Expand description

子进程的 stderr 的句柄。

该结构体用于 Childstderr 字段中。

ChildStderr 的实例被 丢弃 时,ChildStderr 的底层文件句柄将关闭。

Trait Implementations§

1.63.0 · source§

impl AsFd for ChildStderr

Available on Unix only.
source§

fn as_fd(&self) -> BorrowedFd<'_>

借用文件描述符。 Read more
1.63.0 · source§

impl AsHandle for ChildStderr

Available on Windows only.
source§

fn as_handle(&self) -> BorrowedHandle<'_>

借用句柄。 Read more
1.2.0 · source§

impl AsRawFd for ChildStderr

Available on Unix only.
source§

fn as_raw_fd(&self) -> RawFd

提取原始文件描述符。 Read more
1.2.0 · source§

impl AsRawHandle for ChildStderr

Available on Windows only.
source§

fn as_raw_handle(&self) -> RawHandle

提取原始句柄。 Read more
1.16.0 · source§

impl Debug for ChildStderr

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

使用给定的格式化程序格式化该值。 Read more
1.63.0 · source§

impl From<ChildStderr> for OwnedFd

Available on Unix only.
source§

fn from(child_stderr: ChildStderr) -> OwnedFd

从输入类型转换为此类型。
1.63.0 · source§

impl From<ChildStderr> for OwnedHandle

Available on Windows only.
source§

fn from(child_stderr: ChildStderr) -> OwnedHandle

从输入类型转换为此类型。
1.20.0 · source§

impl From<ChildStderr> for Stdio

source§

fn from(child: ChildStderr) -> Stdio

ChildStderr 转换为 Stdio

Examples
use std::process::{Command, Stdio};

let reverse = Command::new("rev")
    .arg("non_existing_file.txt")
    .stderr(Stdio::piped())
    .spawn()
    .expect("failed reverse command");

let cat = Command::new("cat")
    .arg("-")
    .stdin(reverse.stderr.unwrap()) // 在此处转换为 Stdio
    .output()
    .expect("failed echo command");

assert_eq!(
    String::from_utf8_lossy(&cat.stdout),
    "rev: cannot open non_existing_file.txt: No such file or directory\n"
);
Run
1.4.0 · source§

impl IntoRawFd for ChildStderr

Available on Unix only.
source§

fn into_raw_fd(self) -> RawFd

消费这个对象,返回原始的底层文件描述符。 Read more
1.4.0 · source§

impl IntoRawHandle for ChildStderr

Available on Windows only.
source§

fn into_raw_handle(self) -> RawHandle

消耗此对象,返回原始底层句柄。 Read more
source§

impl Read for ChildStderr

source§

fn read(&mut self, buf: &mut [u8]) -> Result<usize>

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

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>

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

fn is_read_vectored(&self) -> bool

🔬This is a nightly-only experimental API. (can_vector #69941)
确定此 Read 是否具有有效的 read_vectored 实现。 Read more
source§

fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize>

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

fn read_to_string(&mut self, buf: &mut String) -> Result<usize>

读取这个源中的所有字节,直到 EOF 为止,然后将它们追加到 bufRead more
1.6.0 · source§

fn read_exact(&mut self, buf: &mut [u8]) -> Result<()>

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

fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<()>

🔬This is a nightly-only experimental API. (read_buf #78485)
读取填充 cursor 所需的确切字节数。 Read more
source§

fn by_ref(&mut self) -> &mut Selfwhere Self: Sized,

为这个 Read 实例创建一个 “by reference” 适配器。 Read more
source§

fn bytes(self) -> Bytes<Self> where Self: Sized,

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

fn chain<R: Read>(self, next: R) -> Chain<Self, R> where Self: Sized,

创建一个适配器,将这个流与另一个链接起来。 Read more
source§

fn take(self, limit: u64) -> Take<Self> where Self: Sized,

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

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

获取 selfTypeIdRead more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

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

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

从拥有的值中借用。 Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

返回未更改的参数。

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

调用 U::from(self)

也就是说,这种转换是 From<T> for U 实现选择执行的任何操作。

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

执行转换。
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

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

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

执行转换。