Struct mmrbi::Command

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

A Cloneable, Displayable clone of std::process::Command

Implementations§

source§

impl Command

source

pub fn new(program: impl AsRef<OsStr>) -> Self

source

pub fn parse(command: impl AsRef<str>) -> Result<Self, String>

source

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

source

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

source

pub fn env( &mut self, key: impl AsRef<OsStr>, val: impl AsRef<OsStr> ) -> &mut Self

source

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

source

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

source

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

source

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

source

pub fn stdin(&mut self, f: impl Fn() -> Stdio + 'static) -> &mut Self

source

pub fn stdout(&mut self, f: impl Fn() -> Stdio + 'static) -> &mut Self

source

pub fn stderr(&mut self, f: impl Fn() -> Stdio + 'static) -> &mut Self

source

pub fn to_command(&self) -> Command

source

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

source

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

source

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

Trait Implementations§

source§

impl Clone for Command

source§

fn clone(&self) -> Command

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl CommandExt for Command

source§

fn status0(&mut self) -> Result<()>

Command::status, but returns an error if the process didn’t have a zero exit code
source§

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

Command::output, but returns an error if the process didn’t have a zero exit code
source§

fn stdout0(&mut self) -> Result<String>

source§

fn stdout0_no_stderr(&mut self) -> Result<String>

source§

fn io( &mut self, on_out: impl Fn(&str) + Send + Sync + 'static, on_err: impl Fn(&str) + Send + Sync + 'static ) -> Result<ExitStatus>

Command::status, but provides a callback for stdout/stderr
source§

fn io0( &mut self, on_out: impl Fn(&str) + Send + Sync + 'static, on_err: impl Fn(&str) + Send + Sync + 'static ) -> Result<()>

Command::status, but provides a callback for stdout/stderr and returns an error if the process didn’t have a zero exit code
source§

impl Debug for Command

source§

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

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

impl Display for Command

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Command

§

impl !Send for Command

§

impl !Sync for Command

§

impl Unpin for Command

§

impl !UnwindSafe for Command

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere 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 Twhere 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.