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

source

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

source

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

source

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

source

pub fn env_clear(&mut self) -> &mut Self

Clears all environment variables in the spawned process.

Equivalent to Command::env_clear

source

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

source

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

source

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

source

pub fn disable_stdin(&mut self) -> &mut Self

Redirects stdin to /dev/null.

source

pub fn disable_stdout(&mut self) -> &mut Self

Redirects stdout to /dev/null.

source

pub fn disable_stderr(&mut self) -> &mut Self

Redirects stderr to /dev/null.

source

pub fn build(&mut self) -> Result<Pool, SpawnError>

Creates the pool.

Trait Implementations§

source§

impl Debug for PoolBuilder

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V