Struct CommandTrace

Source
pub struct CommandTrace<'a> { /* private fields */ }

Implementations§

Source§

impl<'a> CommandTrace<'a>

Source

pub fn builder() -> CommandTraceBuilder<'a, ((), (), (), (), (), (), ())>

Create a builder for building CommandTrace. On the builder, call .command(...), .args(...)(optional), .envs(...)(optional), .current_dir(...)(optional), .status(...)(optional), .stdout(...)(optional), .stderr(...)(optional) to set the values of the fields. Finally, call .build() to create the instance of CommandTrace.

Source§

impl<'a> CommandTrace<'a>

Source

pub fn trace_args<L>(&'a mut self, filter: L) -> &'a mut CommandTrace<'_>
where L: Into<Level>,

Source

pub fn trace_envs<L>(&'a mut self, filter: L) -> &'a mut CommandTrace<'_>
where L: Into<Level>,

Source

pub fn trace_current_dir<L>(&'a mut self, filter: L) -> &'a mut CommandTrace<'_>
where L: Into<Level>,

Source

pub fn trace_status<L>(&'a mut self, filter: L) -> &'a mut CommandTrace<'_>
where L: Into<Level>,

Source

pub fn trace_stdout<L>(&'a mut self, filter: L) -> &'a mut CommandTrace<'_>
where L: Into<Level>,

Source

pub fn trace_stderr<L>(&'a mut self, filter: L) -> &'a mut CommandTrace<'_>
where L: Into<Level>,

Trait Implementations§

Source§

impl<'a> CommandExtCheck for CommandTrace<'a>

Source§

type Error = CommandExtError

The error type for the result of checking for an error status
Source§

fn check(&mut self) -> Result<Output, Self::Error>

Check the result of a command, returning an error containing the output and error stream content if the status is not success
Source§

impl<'a> CommandWrap for CommandTrace<'a>

Source§

fn on_spawn(&mut self)

Called when the child process is spawned using [spawn]
Source§

fn on_output(&mut self)

Called when output is created using [output]
Source§

fn on_status(&mut self)

Called when status is obtained using [status]
Source§

fn after_output(&mut self, output: &Result<Output>)

Called when output is created using [output]
Source§

fn after_status(&mut self, status: &Result<ExitStatus>)

Called when status is obtained using [status]
Source§

fn on_arg<S: AsRef<OsStr>>(&mut self, arg: S)

Called when an arg is added using [arg]
Source§

fn on_args<I, S>(&mut self, args: I)
where I: IntoIterator<Item = S>, S: AsRef<OsStr>,

Called when args are added using [args]
Source§

fn on_env<K, V>(&mut self, key: K, val: V)
where K: AsRef<OsStr>, V: AsRef<OsStr>,

Called when environment variables are configured using env
Source§

fn on_envs<'a, I, K, V>(&mut self, vars: I)
where I: IntoIterator<Item = &'a (K, V)>, K: AsRef<OsStr> + 'a, V: AsRef<OsStr> + 'a,

Called when environment variables are configured using [envs]
Source§

fn on_env_remove<K: AsRef<OsStr>>(&mut self, key: K)

Called when environment variables are removed using [env_remove]
Source§

fn on_env_clear(&mut self)

Called when environment variables are cleared using [env_clear]
Source§

fn on_current_dir<P: AsRef<Path>>(&mut self, dir: P)

Called when the current directory is set using [current_dir]
Source§

fn on_stdin(&mut self, cfg: &Stdio)

Called when stdin is set using [stdin]
Source§

fn on_stdout(&mut self, cfg: &Stdio)

Called when stdout is set using [stdout]
Source§

fn on_stderr(&mut self, cfg: &Stdio)

Called when stderr is set using [stderr]
Source§

fn after_spawn(&mut self, child: &Result<Child>)

Called when the child process is spawned using [spawn]
Source§

fn arg<S: AsRef<OsStr>>(&mut self, arg: S) -> &mut Self

Adds an argument to pass to the program. Read more
Source§

fn args<I, S>(&mut self, args: I) -> &mut Self
where I: IntoIterator<Item = S>, S: AsRef<OsStr>,

Adds multiple arguments to pass to the program. Read more
Source§

fn env<K, V>(&mut self, key: K, val: V) -> &mut Self
where K: AsRef<OsStr>, V: AsRef<OsStr>,

Inserts or updates an explicit environment variable mapping. Read more
Source§

fn envs<I, K, V>(&mut self, vars: I) -> &mut Self
where I: IntoIterator<Item = (K, V)>, K: AsRef<OsStr>, V: AsRef<OsStr>,

Inserts or updates multiple explicit environment variable mappings. Read more
Source§

fn env_remove<K: AsRef<OsStr>>(&mut self, key: K) -> &mut Self

Removes an explicitly set environment variable and prevents inheriting it from a parent process. Read more
Source§

fn env_clear(&mut self) -> &mut Self

Clears all explicitly set environment variables and prevents inheriting any parent process environment variables. Read more
Source§

fn current_dir<P: AsRef<Path>>(&mut self, dir: P) -> &mut Self

Sets the working directory for the child process. Read more
Source§

fn stdin<T: Into<Stdio>>(&mut self, cfg: T) -> &mut Self

Configuration for the child process’s standard input (stdin) handle. Read more
Source§

fn stdout<T: Into<Stdio>>(&mut self, cfg: T) -> &mut Self

Configuration for the child process’s standard output (stdout) handle. Read more
Source§

fn stderr<T: Into<Stdio>>(&mut self, cfg: T) -> &mut Self

Configuration for the child process’s standard error (stderr) handle. Read more
Source§

fn spawn(&mut self) -> Result<Child>

Executes the command as a child process, returning a handle to it. Read more
Source§

fn output(&mut self) -> Result<Output>

Executes the command as a child process, waiting for it to finish and collecting all of its output. Read more
Source§

fn status(&mut self) -> Result<ExitStatus>

Executes a command as a child process, waiting for it to finish and collecting its status. Read more
Source§

fn get_program(&self) -> &OsStr

Returns the path to the program that was given to Command::new. Read more
Source§

fn get_args(&self) -> CommandArgs<'_>

Returns an iterator of the arguments that will be passed to the program. Read more
Source§

fn get_envs(&self) -> CommandEnvs<'_>

Returns an iterator of the environment variables explicitly set for the child process. Read more
Source§

fn get_current_dir(&self) -> Option<&Path>

Returns the working directory for the child process. Read more
Source§

impl<'a> Debug for CommandTrace<'a>

Source§

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

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

impl<'a> From<&'a mut Command> for CommandTrace<'a>

Source§

fn from(value: &'a mut Command) -> Self

Converts to this type from the input type.
Source§

impl<'a> HasCommand for CommandTrace<'a>

Source§

fn command(&self) -> &Command

Source§

fn command_mut(&mut self) -> &mut Command

Auto Trait Implementations§

§

impl<'a> Freeze for CommandTrace<'a>

§

impl<'a> !RefUnwindSafe for CommandTrace<'a>

§

impl<'a> Send for CommandTrace<'a>

§

impl<'a> Sync for CommandTrace<'a>

§

impl<'a> Unpin for CommandTrace<'a>

§

impl<'a> !UnwindSafe for CommandTrace<'a>

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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 = 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>,

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more