Struct procspawn::PoolBuilder
source · pub struct PoolBuilder { /* private fields */ }
Expand description
Utility to configure a pool.
This requires the pool
feature.
Implementations§
source§impl PoolBuilder
impl PoolBuilder
sourcepub fn env<K, V>(&mut self, key: K, val: V) -> &mut Selfwhere
K: AsRef<OsStr>,
V: AsRef<OsStr>,
pub fn env<K, V>(&mut self, key: K, val: V) -> &mut Selfwhere K: AsRef<OsStr>, V: AsRef<OsStr>,
Set an environment variable in the spawned process.
Equivalent to Command::env
sourcepub fn envs<I, K, V>(&mut self, vars: I) -> &mut Selfwhere
I: IntoIterator<Item = (K, V)>,
K: AsRef<OsStr>,
V: AsRef<OsStr>,
pub fn envs<I, K, V>(&mut self, vars: I) -> &mut Selfwhere I: IntoIterator<Item = (K, V)>, K: AsRef<OsStr>, V: AsRef<OsStr>,
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 uid(&mut self, id: u32) -> &mut Self
pub fn uid(&mut self, id: u32) -> &mut Self
Sets the child process’s user ID. This translates to a
setuid
call in the child process. Failure in the setuid
call will cause the spawn to fail.
Unix-specific extension only available on unix.
Equivalent to std::os::unix::process::CommandExt::uid
sourcepub fn gid(&mut self, id: u32) -> &mut Self
pub fn gid(&mut self, id: u32) -> &mut Self
Similar to uid
, but sets the group ID of the child process. This has
the same semantics as the uid
field.
Unix-specific extension only available on unix.
Equivalent to std::os::unix::process::CommandExt::gid
sourcepub unsafe fn pre_exec<F>(&mut self, f: F) -> &mut Selfwhere
F: FnMut() -> Result<()> + Send + Sync + 'static,
pub unsafe fn pre_exec<F>(&mut self, f: F) -> &mut Selfwhere F: FnMut() -> Result<()> + Send + Sync + 'static,
Schedules a closure to be run just before the exec
function is
invoked.
Safety
This method is inherently unsafe. See the notes of the unix command ext for more information.
Equivalent to std::os::unix::process::CommandExt::pre_exec
sourcepub fn disable_stdin(&mut self) -> &mut Self
pub fn disable_stdin(&mut self) -> &mut Self
Redirects stdin to /dev/null
.
sourcepub fn disable_stdout(&mut self) -> &mut Self
pub fn disable_stdout(&mut self) -> &mut Self
Redirects stdout to /dev/null
.
sourcepub fn disable_stderr(&mut self) -> &mut Self
pub fn disable_stderr(&mut self) -> &mut Self
Redirects stderr to /dev/null
.
sourcepub fn build(&mut self) -> Result<Pool, SpawnError>
pub fn build(&mut self) -> Result<Pool, SpawnError>
Creates the pool.