Trait CommandUnify

Source
pub trait CommandUnify<Child: ChildUnify>: Sized {
    // Required methods
    fn new<S: AsRef<OsStr>>(program: S) -> Self;
    fn args<I, S>(&mut self, args: I) -> &mut Self
       where I: IntoIterator<Item = S>,
             S: AsRef<OsStr>;
    fn stdin<T: Into<Stdio>>(&mut self, cfg: T) -> &mut Self;
    fn stdout<T: Into<Stdio>>(&mut self, cfg: T) -> &mut Self;
    fn stderr<T: Into<Stdio>>(&mut self, cfg: T) -> &mut Self;
    fn spawn(&mut self) -> AnyResult<Child>;
}
Expand description

Abstraction of command methods in multiple libraries.

Required Methods§

Source

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

Constructs a new Command for launching the program at path program.

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.

Source

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

Configuration for the child process’s standard input (stdin) handle.

Source

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

Configuration for the child process’s standard output (stdout) handle.

Source

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

Configuration for the child process’s standard error (stderr) handle.

Source

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

Executes the command as a child process, returning a handle to it.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl CommandUnify<Child> for Command

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

fn spawn(&mut self) -> AnyResult<StdChild>

Source§

impl CommandUnify<Child> for Command

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

fn spawn(&mut self) -> AnyResult<SmolChild>

Source§

impl CommandUnify<Child> for Command

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

fn spawn(&mut self) -> AnyResult<TokioChild>

Implementors§