Skip to main content

Child

Struct Child 

Source
pub struct Child { /* private fields */ }
Expand description

A running program. Dropping it before it exits kills it.

Implementations§

Source§

impl Child

Source

pub fn next_event(&mut self) -> Result<Event>

The next thing the child does, running it until then.

Source

pub fn write_stdin(&mut self, bytes: &[u8])

Queues bytes for the child’s stdin, delivered when it next runs.

Source

pub fn close_stdin(&mut self)

Ends the child’s stdin: its next read past what is queued gets end of file.

Source

pub fn kill(&mut self)

Stops the child now.

Source

pub fn wait(self) -> Result<ExitStatus>

Relays the child’s output to this program’s stdout and its reads to this program’s stdin, until it exits.

Source

pub fn wait_with_output(self) -> Result<Output>

Collects the child’s output until it exits. Its reads get whatever was queued with Child::write_stdin, then end of file.

Trait Implementations§

Source§

impl Debug for Child

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Drop for Child

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

impl Forget for Child

§

impl Freeze for Child

§

impl Move for Child

§

impl RefUnwindSafe for Child

§

impl Send for Child

§

impl Sync for Child

§

impl Unpin for Child

§

impl UnsafeUnpin for Child

§

impl UnwindSafe for Child

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

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

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.