Struct ezcmd::EasyCommand

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

A convenience API around Command.

Implementations§

source§

impl EasyCommand

source

pub fn new<C>(cmd: C) -> Selfwhere C: AsRef<OsStr>,

Equivalent to Command::new.

source

pub fn new_with<C>(cmd: C, f: impl FnOnce(&mut Command) -> &mut Command) -> Selfwhere C: AsRef<OsStr>,

A convenience constructor that allows other method calls to be chained onto this one.

source

pub fn simple<C, A, I>(cmd: C, args: I) -> Selfwhere C: AsRef<OsStr>, A: AsRef<OsStr>, I: IntoIterator<Item = A>,

Like Self::new_with, but optimized for ergonomic usage of an IntoIterator for arguments.

source

pub fn spawn_and_wait( &mut self ) -> Result<ExitStatus, ExecuteError<SpawnAndWaitErrorKind>>

Execute this command, returning its exit status.

This command wraps around Command::spawn, which causes stdout and stderr to be inherited from its parent.

source

pub fn run(&mut self) -> Result<(), ExecuteError<RunErrorKind>>

Execute this command, returning an error if it did not return a successful exit code.

This command wraps around Command::spawn, which causes stdout and stderr to be inherited from its parent.

source

pub fn output(&mut self) -> Result<Output, ExecuteError<Error>>

Execute this command, capturing its output.

Trait Implementations§

source§

impl Debug for EasyCommand

source§

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

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

impl Display for EasyCommand

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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