pub struct ProcessConfig {
pub name: String,
pub executable: PathBuf,
pub args: Vec<OsString>,
pub working_dir: Option<PathBuf>,
pub env: Vec<(String, String)>,
pub memory_limit: Option<String>,
pub cpu_quota: Option<u32>,
pub unit_properties: Vec<(String, String)>,
pub restart_on_failure: bool,
pub readiness: ProcessReadiness,
}Expand description
Configuration for spawning a daemon process.
Fields§
§name: StringHuman-readable name for the daemon (used in unit names).
executable: PathBufPath to the executable.
args: Vec<OsString>Command-line arguments.
working_dir: Option<PathBuf>Working directory.
env: Vec<(String, String)>Environment variables (key=value).
memory_limit: Option<String>Memory limit (systemd only, e.g., “1G”, “512M”).
cpu_quota: Option<u32>CPU quota percentage (systemd only, e.g., 200 for 2 cores).
unit_properties: Vec<(String, String)>Custom unit properties (systemd only).
restart_on_failure: boolWhether to restart on failure (systemd only).
readiness: ProcessReadinessWhen the spawn may be reported as started (#1585).
Implementations§
Source§impl ProcessConfig
impl ProcessConfig
Sourcepub fn new(
name: impl Into<String>,
executable: impl Into<PathBuf>,
) -> ProcessConfig
pub fn new( name: impl Into<String>, executable: impl Into<PathBuf>, ) -> ProcessConfig
Create a new process configuration.
Sourcepub fn with_notify_ready(self, timeout: Duration) -> ProcessConfig
pub fn with_notify_ready(self, timeout: Duration) -> ProcessConfig
Require the child’s own READY=1 notification within timeout
before the spawn reports success (#1585).
Sourcepub fn args<I, S>(self, args: I) -> ProcessConfig
pub fn args<I, S>(self, args: I) -> ProcessConfig
Set command-line arguments.
Sourcepub fn working_dir(self, dir: impl Into<PathBuf>) -> ProcessConfig
pub fn working_dir(self, dir: impl Into<PathBuf>) -> ProcessConfig
Set working directory.
Sourcepub fn env(
self,
key: impl Into<String>,
value: impl Into<String>,
) -> ProcessConfig
pub fn env( self, key: impl Into<String>, value: impl Into<String>, ) -> ProcessConfig
Add an environment variable.
Sourcepub fn memory_limit(self, limit: impl Into<String>) -> ProcessConfig
pub fn memory_limit(self, limit: impl Into<String>) -> ProcessConfig
Set memory limit (e.g., “1G”, “512M”).
Sourcepub fn cpu_quota(self, quota: u32) -> ProcessConfig
pub fn cpu_quota(self, quota: u32) -> ProcessConfig
Set CPU quota percentage (e.g., 200 for 2 cores).
Sourcepub fn unit_property(
self,
key: impl Into<String>,
value: impl Into<String>,
) -> ProcessConfig
pub fn unit_property( self, key: impl Into<String>, value: impl Into<String>, ) -> ProcessConfig
Add a custom systemd unit property.
Sourcepub fn restart_on_failure(self) -> ProcessConfig
pub fn restart_on_failure(self) -> ProcessConfig
Enable restart on failure.
Trait Implementations§
Source§impl Clone for ProcessConfig
impl Clone for ProcessConfig
Source§fn clone(&self) -> ProcessConfig
fn clone(&self) -> ProcessConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for ProcessConfig
impl RefUnwindSafe for ProcessConfig
impl Send for ProcessConfig
impl Sync for ProcessConfig
impl Unpin for ProcessConfig
impl UnsafeUnpin for ProcessConfig
impl UnwindSafe for ProcessConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more