pub struct CommandExecutorBuilder { /* private fields */ }
Expand description
The builder for a default CommandExecutor
that should fit most use-cases.
Implementations
sourceimpl CommandExecutorBuilder
impl CommandExecutorBuilder
sourcepub fn program<O>(&mut self, program: O) -> &mut Self where
O: AsRef<OsStr>,
pub fn program<O>(&mut self, program: O) -> &mut Self where
O: AsRef<OsStr>,
Set the binary to execute This option is required.
sourcepub fn arg_input_arg(&mut self) -> &mut Self
pub fn arg_input_arg(&mut self) -> &mut Self
Sets the input mode to InputLocation::Arg
and uses the current arg offset as argnum
.
During execution, at input will be provided as argument at this position.
Use Self::arg_input_file_std
if you want to provide the input as a file instead.
sourcepub fn arg_input_file_std(&mut self) -> &mut Self
pub fn arg_input_file_std(&mut self) -> &mut Self
Sets the input mode to InputLocation::File
and adds the filename as arg to at the current position.
Uses a default filename.
Use Self::arg_input_file
to specify a custom filename.
sourcepub fn arg_input_file<P: AsRef<Path>>(&mut self, path: P) -> &mut Self
pub fn arg_input_file<P: AsRef<Path>>(&mut self, path: P) -> &mut Self
Sets the input mode to InputLocation::File
and adds the filename as arg to at the current position.
sourcepub fn arg<O: AsRef<OsStr>>(&mut self, arg: O) -> &mut CommandExecutorBuilder
pub fn arg<O: AsRef<OsStr>>(&mut self, arg: O) -> &mut CommandExecutorBuilder
Adds an argument to the program’s commandline.
sourcepub fn args<IT, O>(&mut self, args: IT) -> &mut CommandExecutorBuilder where
IT: IntoIterator<Item = O>,
O: AsRef<OsStr>,
pub fn args<IT, O>(&mut self, args: IT) -> &mut CommandExecutorBuilder where
IT: IntoIterator<Item = O>,
O: AsRef<OsStr>,
Adds a range of arguments to the program’s commandline.
sourcepub fn envs<IT, K, V>(&mut self, vars: IT) -> &mut CommandExecutorBuilder where
IT: IntoIterator<Item = (K, V)>,
K: AsRef<OsStr>,
V: AsRef<OsStr>,
pub fn envs<IT, K, V>(&mut self, vars: IT) -> &mut CommandExecutorBuilder where
IT: IntoIterator<Item = (K, V)>,
K: AsRef<OsStr>,
V: AsRef<OsStr>,
Adds a range of environment variables to the executed command.
sourcepub fn env<K, V>(&mut self, key: K, val: V) -> &mut CommandExecutorBuilder where
K: AsRef<OsStr>,
V: AsRef<OsStr>,
pub fn env<K, V>(&mut self, key: K, val: V) -> &mut CommandExecutorBuilder where
K: AsRef<OsStr>,
V: AsRef<OsStr>,
Adds an environment variable to the executed command.
sourcepub fn current_dir<P: AsRef<Path>>(
&mut self,
dir: P
) -> &mut CommandExecutorBuilder
pub fn current_dir<P: AsRef<Path>>(
&mut self,
dir: P
) -> &mut CommandExecutorBuilder
Sets the working directory for the child process.
sourcepub fn debug_child(&mut self, debug_child: bool) -> &mut CommandExecutorBuilder
pub fn debug_child(&mut self, debug_child: bool) -> &mut CommandExecutorBuilder
If set to true, the child’s output won’t be redirecited to /dev/null
.
Defaults to false
.
sourcepub fn build<EM, I, OT, S, Z>(
&self,
observers: OT
) -> Result<CommandExecutor<EM, I, OT, S, StdCommandConfigurator, Z>, Error> where
OT: Debug + MatchName,
pub fn build<EM, I, OT, S, Z>(
&self,
observers: OT
) -> Result<CommandExecutor<EM, I, OT, S, StdCommandConfigurator, Z>, Error> where
OT: Debug + MatchName,
Builds the ComandExecutor
Trait Implementations
sourceimpl Clone for CommandExecutorBuilder
impl Clone for CommandExecutorBuilder
sourcefn clone(&self) -> CommandExecutorBuilder
fn clone(&self) -> CommandExecutorBuilder
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for CommandExecutorBuilder
impl Debug for CommandExecutorBuilder
Auto Trait Implementations
impl !RefUnwindSafe for CommandExecutorBuilder
impl !Send for CommandExecutorBuilder
impl !Sync for CommandExecutorBuilder
impl Unpin for CommandExecutorBuilder
impl !UnwindSafe for CommandExecutorBuilder
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Tail, T> Prepend<T> for Tail
impl<Tail, T> Prepend<T> for Tail
type PreprendResult = Tail
type PreprendResult = Tail
The Resulting TupleList
, of an Prepend::prepend()
call,
including the prepended entry. Read more
sourcefn prepend(self, value: T) -> (T, <Tail as Prepend<T>>::PreprendResult)
fn prepend(self, value: T) -> (T, <Tail as Prepend<T>>::PreprendResult)
Prepend a value to this tuple, returning a new tuple with prepended value.