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>) -> Self
pub fn new(name: impl Into<String>, executable: impl Into<PathBuf>) -> Self
Create a new process configuration.
Sourcepub fn with_notify_ready(self, timeout: Duration) -> Self
pub fn with_notify_ready(self, timeout: Duration) -> Self
Require the child’s own READY=1 notification within timeout
before the spawn reports success (#1585).
Sourcepub fn working_dir(self, dir: impl Into<PathBuf>) -> Self
pub fn working_dir(self, dir: impl Into<PathBuf>) -> Self
Set working directory.
Sourcepub fn env(self, key: impl Into<String>, value: impl Into<String>) -> Self
pub fn env(self, key: impl Into<String>, value: impl Into<String>) -> Self
Add an environment variable.
Sourcepub fn memory_limit(self, limit: impl Into<String>) -> Self
pub fn memory_limit(self, limit: impl Into<String>) -> Self
Set memory limit (e.g., “1G”, “512M”).
Sourcepub fn unit_property(
self,
key: impl Into<String>,
value: impl Into<String>,
) -> Self
pub fn unit_property( self, key: impl Into<String>, value: impl Into<String>, ) -> Self
Add a custom systemd unit property.
Sourcepub fn restart_on_failure(self) -> Self
pub fn restart_on_failure(self) -> Self
Enable restart on failure.
Trait Implementations§
Source§impl Clone for ProcessConfig
impl Clone for ProcessConfig
Source§fn clone(&self) -> ProcessConfig
fn clone(&self) -> ProcessConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> ServiceExt for T
impl<T> ServiceExt for T
§fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
Apply a transformation to the response body. Read more
§fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
High level tracing that classifies responses using HTTP status codes. Read more
§fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
High level tracing that classifies responses using gRPC headers. Read more