[−][src]Struct procspawn::Builder
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.
Methods
impl Builder
[src]
pub fn new() -> Self
[src]
Generates the base configuration for spawning a thread, from which configuration methods can be chained.
pub fn env<K, V>(&mut self, key: K, val: V) -> &mut Self where
K: AsRef<OsStr>,
V: AsRef<OsStr>,
[src]
K: AsRef<OsStr>,
V: AsRef<OsStr>,
Set an environment variable in the spawned process.
Equivalent to Command::env
pub fn envs<I, K, V>(&mut self, vars: I) -> &mut Self where
I: IntoIterator<Item = (K, V)>,
K: AsRef<OsStr>,
V: AsRef<OsStr>,
[src]
I: IntoIterator<Item = (K, V)>,
K: AsRef<OsStr>,
V: AsRef<OsStr>,
Set environment variables in the spawned process.
Equivalent to Command::envs
pub fn env_remove<K: AsRef<OsStr>>(&mut self, key: K) -> &mut Self
[src]
Removes an environment variable in the spawned process.
Equivalent to Command::env_remove
pub fn env_clear(&mut self) -> &mut Self
[src]
Clears all environment variables in the spawned process.
Equivalent to Command::env_clear
pub fn uid(&mut self, id: u32) -> &mut Self
[src]
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
pub fn gid(&mut self, id: u32) -> &mut Self
[src]
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
pub unsafe fn pre_exec<F>(&mut self, f: F) -> &mut Self where
F: FnMut() -> Result<()> + Send + Sync + 'static,
[src]
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
pub fn stdin<T: Into<Stdio>>(&mut self, cfg: T) -> &mut Self
[src]
Captures the stdin
of the spawned process, allowing you to manually
send data via JoinHandle::stdin
For async spawns sending data is currently not supported.
pub fn stdout<T: Into<Stdio>>(&mut self, cfg: T) -> &mut Self
[src]
Captures the stdout
of the spawned process, allowing you to manually
receive data via JoinHandle::stdout
For async spawns retrieving the data is currently not supported.
pub fn stderr<T: Into<Stdio>>(&mut self, cfg: T) -> &mut Self
[src]
Captures the stderr
of the spawned process, allowing you to manually
receive data via JoinHandle::stderr
For async spawns retrieving the data is currently not supported.
pub fn spawn<A: Serialize + DeserializeOwned, R: Serialize + DeserializeOwned>(
&mut self,
args: A,
func: fn(_: A) -> R
) -> JoinHandle<R>
[src]
&mut self,
args: A,
func: fn(_: A) -> R
) -> JoinHandle<R>
Spawns the process.
pub fn spawn_async<A: Serialize + DeserializeOwned, R: Serialize + DeserializeOwned>(
&mut self,
args: A,
func: fn(_: A) -> R
) -> AsyncJoinHandle<R>
[src]
&mut self,
args: A,
func: fn(_: A) -> R
) -> AsyncJoinHandle<R>
Spawns the process (async).
This is the async equivalent of spawn
.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Builder
impl Send for Builder
impl Sync for Builder
impl Unpin for Builder
impl UnwindSafe for Builder
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,