Struct async_process::ChildStdout
source · [−]pub struct ChildStdout(_);
Expand description
A handle to a child process’s standard output (stdout).
When a ChildStdout
is dropped, the underlying handle gets closed.
Implementations
sourceimpl ChildStdout
impl ChildStdout
sourcepub async fn into_stdio(self) -> Result<Stdio>
pub async fn into_stdio(self) -> Result<Stdio>
Convert async_process::ChildStdout into std::process::Stdio.
You can use it to associate to the next process.
Examples
use async_process::Command;
use std::process::Stdio;
use std::io::Read;
use futures_lite::AsyncReadExt;
let mut ls_child = Command::new("ls").stdout(Stdio::piped()).spawn()?;
let stdio:Stdio = ls_child.stdout.take().unwrap().into_stdio().await?;
let mut echo_child = Command::new("echo").stdin(stdio).stdout(Stdio::piped()).spawn()?;
let mut buf = vec![];
echo_child.stdout.take().unwrap().read(&mut buf).await;
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for ChildStdout
impl Send for ChildStdout
impl Sync for ChildStdout
impl Unpin for ChildStdout
impl UnwindSafe for ChildStdout
Blanket Implementations
sourceimpl<R> AsyncReadExt for R where
R: AsyncRead + ?Sized,
impl<R> AsyncReadExt for R where
R: AsyncRead + ?Sized,
sourcefn read(&'a mut self, buf: &'a mut [u8]) -> ReadFuture<'a, Self> where
Self: Unpin,
fn read(&'a mut self, buf: &'a mut [u8]) -> ReadFuture<'a, Self> where
Self: Unpin,
Reads some bytes from the byte stream. Read more
sourcefn read_vectored(
&'a mut self,
bufs: &'a mut [IoSliceMut<'a>]
) -> ReadVectoredFuture<'a, Self> where
Self: Unpin,
fn read_vectored(
&'a mut self,
bufs: &'a mut [IoSliceMut<'a>]
) -> ReadVectoredFuture<'a, Self> where
Self: Unpin,
sourcefn read_to_end(
&'a mut self,
buf: &'a mut Vec<u8, Global>
) -> ReadToEndFuture<'a, Self> where
Self: Unpin,
fn read_to_end(
&'a mut self,
buf: &'a mut Vec<u8, Global>
) -> ReadToEndFuture<'a, Self> where
Self: Unpin,
sourcefn read_to_string(
&'a mut self,
buf: &'a mut String
) -> ReadToStringFuture<'a, Self> where
Self: Unpin,
fn read_to_string(
&'a mut self,
buf: &'a mut String
) -> ReadToStringFuture<'a, Self> where
Self: Unpin,
sourcefn read_exact(&'a mut self, buf: &'a mut [u8]) -> ReadExactFuture<'a, Self> where
Self: Unpin,
fn read_exact(&'a mut self, buf: &'a mut [u8]) -> ReadExactFuture<'a, Self> where
Self: Unpin,
Reads the exact number of bytes required to fill buf
. Read more
sourcefn take(self, limit: u64) -> Take<Self>
fn take(self, limit: u64) -> Take<Self>
Creates an adapter which will read at most limit
bytes from it. Read more
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more