pub struct ExecSpecBuilder {
pub working_dir: Option<PathBuf>,
pub executable: Option<OsString>,
pub clargs: Vec<OsString>,
pub env: HashMap<String, String>,
/* private fields */
}
Expand description
Builds exec specs
Fields§
§working_dir: Option<PathBuf>
The working directory to run the executable in
executable: Option<OsString>
The executable
clargs: Vec<OsString>
The command line args for the executable
env: HashMap<String, String>
The environment variables for the executable. By default, the exec spec will inherit from the parent process.
§Warning
ONLY The environment variables in this map will be passed to the executable.
Implementations§
Source§impl ExecSpecBuilder
impl ExecSpecBuilder
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new ExecSpecBuilder.
Sourcepub fn default_env() -> HashMap<String, String>
pub fn default_env() -> HashMap<String, String>
The default environment variables
Sourcepub fn with_env<I: IntoIterator<Item = (String, String)>>(
&mut self,
env: I,
) -> &mut Self
pub fn with_env<I: IntoIterator<Item = (String, String)>>( &mut self, env: I, ) -> &mut Self
Changes the environment variables to the contents of this map.
§Warning
This will clear all previously set values in the environment map
Sourcepub fn extend_env<I: IntoIterator<Item = (String, String)>>(
&mut self,
env: I,
) -> &mut Self
pub fn extend_env<I: IntoIterator<Item = (String, String)>>( &mut self, env: I, ) -> &mut Self
Adds variables to the environment
Sourcepub fn add_env<'a>(
&mut self,
env: &str,
value: impl Into<Option<&'a str>>,
) -> &mut Self
pub fn add_env<'a>( &mut self, env: &str, value: impl Into<Option<&'a str>>, ) -> &mut Self
Adds variables to the environment
Sourcepub fn args<I, S: AsRef<OsStr>>(&mut self, args: I) -> &mut Selfwhere
I: IntoIterator<Item = S>,
pub fn args<I, S: AsRef<OsStr>>(&mut self, args: I) -> &mut Selfwhere
I: IntoIterator<Item = S>,
Add many args to the command
Sourcepub fn with_args<I, S: AsRef<OsStr>>(self, args: I) -> Selfwhere
I: IntoIterator<Item = S>,
pub fn with_args<I, S: AsRef<OsStr>>(self, args: I) -> Selfwhere
I: IntoIterator<Item = S>,
Add many args to the command
Sourcepub fn exec<E: AsRef<OsStr>>(&mut self, exec: E) -> &mut Self
pub fn exec<E: AsRef<OsStr>>(&mut self, exec: E) -> &mut Self
Set the executable for the exec spec
Sourcepub fn working_dir<P: AsRef<Path>>(&mut self, path: P) -> &mut Self
pub fn working_dir<P: AsRef<Path>>(&mut self, path: P) -> &mut Self
Set the working directory for the exec spec. If the path is relative, it will be resolved to the project directory.
Sourcepub fn stdin<In>(&mut self, input: In) -> &mut Self
pub fn stdin<In>(&mut self, input: In) -> &mut Self
Set the standard input for the executable. doesn’t need to be set
Sourcepub fn with_stdin<In>(self, input: In) -> Self
pub fn with_stdin<In>(self, input: In) -> Self
Set the standard input for the executable. doesn’t need to be set
Sourcepub fn with_stdout<O>(self, output: O) -> Self
pub fn with_stdout<O>(self, output: O) -> Self
Sets the output type for this exec spec
Sourcepub fn with_stderr<O>(self, output: O) -> Self
pub fn with_stderr<O>(self, output: O) -> Self
Sets the output type for this exec spec
Auto Trait Implementations§
impl Freeze for ExecSpecBuilder
impl RefUnwindSafe for ExecSpecBuilder
impl Send for ExecSpecBuilder
impl Sync for ExecSpecBuilder
impl Unpin for ExecSpecBuilder
impl UnwindSafe for ExecSpecBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> InstanceOf for T
impl<T> InstanceOf for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more