pub struct Builder { /* private fields */ }Expand description
Process factory, which can be used in order to configure the properties of a process being created.
Methods can be chained on it in order to configure it.
Implementations§
Source§impl Builder
impl Builder
Sourcepub fn new() -> Self
pub fn new() -> Self
Generates the base configuration for spawning a thread, from which configuration methods can be chained.
Sourcepub fn env<K, V>(&mut self, key: K, val: V) -> &mut Self
pub fn env<K, V>(&mut self, key: K, val: V) -> &mut Self
Set an environment variable in the spawned process.
Equivalent to Command::env
Sourcepub fn envs<I, K, V>(&mut self, vars: I) -> &mut Self
pub fn envs<I, K, V>(&mut self, vars: I) -> &mut Self
Set environment variables in the spawned process.
Equivalent to Command::envs
Sourcepub fn env_remove<K: AsRef<OsStr>>(&mut self, key: K) -> &mut Self
pub fn env_remove<K: AsRef<OsStr>>(&mut self, key: K) -> &mut Self
Removes an environment variable in the spawned process.
Equivalent to Command::env_remove
Sourcepub fn env_clear(&mut self) -> &mut Self
pub fn env_clear(&mut self) -> &mut Self
Clears all environment variables in the spawned process.
Equivalent to Command::env_clear
Sourcepub fn stdin<T: Into<Stdio>>(&mut self, cfg: T) -> &mut Self
pub fn stdin<T: Into<Stdio>>(&mut self, cfg: T) -> &mut Self
Captures the stdin of the spawned process, allowing you to manually
send data via JoinHandle::stdin
Sourcepub fn stdout<T: Into<Stdio>>(&mut self, cfg: T) -> &mut Self
pub fn stdout<T: Into<Stdio>>(&mut self, cfg: T) -> &mut Self
Captures the stdout of the spawned process, allowing you to manually
receive data via JoinHandle::stdout
Sourcepub fn stderr<T: Into<Stdio>>(&mut self, cfg: T) -> &mut Self
pub fn stderr<T: Into<Stdio>>(&mut self, cfg: T) -> &mut Self
Captures the stderr of the spawned process, allowing you to manually
receive data via JoinHandle::stderr
Sourcepub fn spawn<A: Serialize + DeserializeOwned, R: Serialize + DeserializeOwned>(
&mut self,
args: A,
func: fn(A) -> R,
) -> JoinHandle<R>
pub fn spawn<A: Serialize + DeserializeOwned, R: Serialize + DeserializeOwned>( &mut self, args: A, func: fn(A) -> R, ) -> JoinHandle<R>
Spawns the process.