pub trait CommandExtra: Sized {
// Required methods
fn with_current_dir(self, dir: impl AsRef<Path>) -> Self;
fn with_env(self, key: impl AsRef<OsStr>, value: impl AsRef<OsStr>) -> Self;
fn without_env(self, key: impl AsRef<OsStr>) -> Self;
fn with_no_env(self) -> Self;
fn with_arg(self, arg: impl AsRef<OsStr>) -> Self;
fn with_stdin(self, stdio: Stdio) -> Self;
fn with_stdout(self, stdio: Stdio) -> Self;
fn with_stderr(self, stdio: Stdio) -> Self;
// Provided methods
fn with_args<Args>(self, args: Args) -> Self
where Args: IntoIterator,
Args::Item: AsRef<OsStr> { ... }
fn with_envs<Envs, Key, Value>(self, envs: Envs) -> Self
where Envs: IntoIterator<Item = (Key, Value)>,
Key: AsRef<OsStr>,
Value: AsRef<OsStr> { ... }
fn without_envs<Keys>(self, keys: Keys) -> Self
where Keys: IntoIterator,
Keys::Item: AsRef<OsStr> { ... }
}Expand description
Builder-style methods for Command that take self and return Self.
Required Methods§
Sourcefn with_current_dir(self, dir: impl AsRef<Path>) -> Self
fn with_current_dir(self, dir: impl AsRef<Path>) -> Self
Sets the working directory.
Corresponds to Command::current_dir.
Sourcefn with_env(self, key: impl AsRef<OsStr>, value: impl AsRef<OsStr>) -> Self
fn with_env(self, key: impl AsRef<OsStr>, value: impl AsRef<OsStr>) -> Self
Sets an environment variable.
Corresponds to Command::env.
Sourcefn without_env(self, key: impl AsRef<OsStr>) -> Self
fn without_env(self, key: impl AsRef<OsStr>) -> Self
Removes an environment variable.
Corresponds to Command::env_remove.
Sourcefn with_no_env(self) -> Self
fn with_no_env(self) -> Self
Clears all environment variables.
Corresponds to Command::env_clear.
Sourcefn with_arg(self, arg: impl AsRef<OsStr>) -> Self
fn with_arg(self, arg: impl AsRef<OsStr>) -> Self
Adds one argument.
Corresponds to Command::arg.
Sourcefn with_stdin(self, stdio: Stdio) -> Self
fn with_stdin(self, stdio: Stdio) -> Self
Configures stdin.
Corresponds to Command::stdin.
Sourcefn with_stdout(self, stdio: Stdio) -> Self
fn with_stdout(self, stdio: Stdio) -> Self
Configures stdout.
Corresponds to Command::stdout.
Sourcefn with_stderr(self, stdio: Stdio) -> Self
fn with_stderr(self, stdio: Stdio) -> Self
Configures stderr.
Corresponds to Command::stderr.
Provided Methods§
Sourcefn with_args<Args>(self, args: Args) -> Self
fn with_args<Args>(self, args: Args) -> Self
Adds multiple arguments.
Corresponds to Command::args.
Sourcefn with_envs<Envs, Key, Value>(self, envs: Envs) -> Self
fn with_envs<Envs, Key, Value>(self, envs: Envs) -> Self
Sets multiple environment variables.
Corresponds to Command::envs.
Sourcefn without_envs<Keys>(self, keys: Keys) -> Self
fn without_envs<Keys>(self, keys: Keys) -> Self
Removes multiple environment variables.
Equivalent to repeated Command::env_remove; no direct inherent method.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".