use std::time::Duration;
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
#[non_exhaustive]
pub struct SignalPolicy {
pub grace_period: Duration,
pub create_process_group: bool,
pub terminate_descendants: bool,
}
impl Default for SignalPolicy {
fn default() -> Self {
Self {
grace_period: Duration::from_secs(5),
create_process_group: true,
terminate_descendants: true,
}
}
}
impl SignalPolicy {
#[must_use]
pub fn with_grace_period(mut self, grace_period: Duration) -> Self {
self.grace_period = grace_period;
self
}
#[must_use]
pub fn with_create_process_group(mut self, create_process_group: bool) -> Self {
self.create_process_group = create_process_group;
self
}
#[must_use]
pub fn with_terminate_descendants(mut self, terminate_descendants: bool) -> Self {
self.terminate_descendants = terminate_descendants;
self
}
}