pub struct ProcessSpec {
pub program: PathBuf,
pub args: Vec<OsString>,
pub dir: Option<PathBuf>,
pub env: HashMap<String, String>,
pub env_policy: EnvPolicy,
}Expand description
What to execute as a subprocess.
Fields§
§program: PathBufProgram name or path to execute.
args: Vec<OsString>Command-line arguments.
dir: Option<PathBuf>Working directory for the process.
env: HashMap<String, String>Environment variables to set.
env_policy: EnvPolicyEnvironment inheritance policy.
Implementations§
Source§impl ProcessSpec
impl ProcessSpec
Sourcepub fn new<P: Into<PathBuf>>(program: P) -> Self
pub fn new<P: Into<PathBuf>>(program: P) -> Self
Create a new process spec with just a program name.
Sourcepub fn env<K: Into<String>, V: Into<String>>(self, key: K, value: V) -> Self
pub fn env<K: Into<String>, V: Into<String>>(self, key: K, value: V) -> Self
Set an environment variable.
Sourcepub fn envs<K: Into<String>, V: Into<String>, I: IntoIterator<Item = (K, V)>>(
self,
vars: I,
) -> Self
pub fn envs<K: Into<String>, V: Into<String>, I: IntoIterator<Item = (K, V)>>( self, vars: I, ) -> Self
Set multiple environment variables.
Sourcepub fn env_policy(self, policy: EnvPolicy) -> Self
pub fn env_policy(self, policy: EnvPolicy) -> Self
Set the environment policy.
Trait Implementations§
Source§impl Clone for ProcessSpec
impl Clone for ProcessSpec
Source§fn clone(&self) -> ProcessSpec
fn clone(&self) -> ProcessSpec
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ProcessSpec
impl Debug for ProcessSpec
impl Eq for ProcessSpec
Source§impl PartialEq for ProcessSpec
impl PartialEq for ProcessSpec
Source§fn eq(&self, other: &ProcessSpec) -> bool
fn eq(&self, other: &ProcessSpec) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for ProcessSpec
Auto Trait Implementations§
impl Freeze for ProcessSpec
impl RefUnwindSafe for ProcessSpec
impl Send for ProcessSpec
impl Sync for ProcessSpec
impl Unpin for ProcessSpec
impl UnsafeUnpin for ProcessSpec
impl UnwindSafe for ProcessSpec
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
Mutably borrows from an owned value. Read more