pub struct ChildContext<C> { /* private fields */ }
Expand description

A Child process combined with context about the Command that produced it.

The context information stored in this type is used to produce diagnostics in ChildExt.

See: OutputContext.

Implementations§

source§

impl<C> ChildContext<C>

source

pub fn into_child(self) -> C

Get the child process.

source

pub fn child(&self) -> &C

Get a reference to the child process.

source

pub fn child_mut(&mut self) -> &mut C

Get a mutable reference to the child process.

source

pub fn command(&self) -> &(dyn CommandDisplay + Send + Sync)

Get a reference to the command which produced this child process.

Trait Implementations§

source§

impl ChildExt for ChildContext<Child>

§

type Error = Error

The error type returned from methods on this trait.
source§

fn output_checked_as<O, R, E>( self, succeeded: impl Fn(OutputContext<O>) -> Result<R, E> ) -> Result<R, E>
where O: Debug + OutputLike + 'static + TryFrom<Output>, <O as TryFrom<Output>>::Error: Display + Send + Sync, E: From<Self::Error>,

Wait for the process to complete, capturing its output. succeeded is called and returned to determine if the command succeeded. Read more
source§

fn try_wait_checked_as<R, E>( &mut self, succeeded: impl Fn(TryWaitContext) -> Result<R, E> ) -> Result<R, E>
where E: From<Self::Error>,

Check if the process has exited. Read more
source§

fn wait_checked_as<R, E>( &mut self, succeeded: impl Fn(OutputContext<ExitStatus>) -> Result<R, E> ) -> Result<R, E>
where E: From<Self::Error>,

Wait for the process to exit. succeeded is called and returned to determine if the command succeeded. Read more
source§

fn log(&self) -> Result<(), Self::Error>

Log the command that will be run. Read more
source§

fn output_checked_with<O, E>( self, succeeded: impl Fn(&O) -> Result<(), Option<E>> ) -> Result<O, Self::Error>
where O: Debug + OutputLike + TryFrom<Output> + Send + Sync + 'static, <O as TryFrom<Output>>::Error: Display + Send + Sync, E: Debug + Display + Send + Sync + 'static,

Wait for the process to complete, capturing its output. succeeded is called and used to determine if the command succeeded and (optionally) to add an additional message to the error returned. Read more
source§

fn output_checked(self) -> Result<Output, Self::Error>

Wait for the process to complete, capturing its output. If the command exits with a non-zero exit code, an error is raised. Read more
source§

fn output_checked_utf8(self) -> Result<Utf8Output, Self::Error>

Wait for the process to exit, capturing its output and decoding it as UTF-8. If the command exits with a non-zero exit code, an error is raised. Read more
source§

fn output_checked_with_utf8<E>( self, succeeded: impl Fn(&Utf8Output) -> Result<(), Option<E>> ) -> Result<Utf8Output, Self::Error>
where E: Display + Debug + Send + Sync + 'static,

Wait for the process to exit, capturing its output and decoding it as UTF-8. succeeded is called and used to determine if the command succeeded and (optionally) to add an additional message to the error returned. Read more
source§

fn try_wait_checked(&mut self) -> Result<Option<ExitStatus>, Self::Error>

Check if the process has exited and, if it failed, return an error. Read more
source§

fn wait_checked_with<E>( &mut self, succeeded: impl Fn(ExitStatus) -> Result<(), Option<E>> ) -> Result<ExitStatus, Self::Error>
where E: Debug + Display + Send + Sync + 'static,

Wait for the process to exit. succeeded is called and used to determine if the command succeeded and (optionally) to add an additional message to the error returned. Read more
source§

fn wait_checked(&mut self) -> Result<ExitStatus, Self::Error>

Wait for the process to exit. If the command exits with a non-zero status code, an error is raised containing information about the command that was run. Read more
source§

impl<C> Debug for ChildContext<C>
where C: Debug,

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<C> Freeze for ChildContext<C>
where C: Freeze,

§

impl<C> !RefUnwindSafe for ChildContext<C>

§

impl<C> Send for ChildContext<C>
where C: Send,

§

impl<C> Sync for ChildContext<C>
where C: Sync,

§

impl<C> Unpin for ChildContext<C>
where C: Unpin,

§

impl<C> !UnwindSafe for ChildContext<C>

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>,

§

type Error = Infallible

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

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

Performs the conversion.
source§

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

§

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.