pub struct SupervisorBuilder { /* private fields */ }Expand description
Builds a Supervisor instance with configurable parameters.
Allows customization of task timeout, heartbeat interval, health check timing, and per-task restart settings.
Implementations§
Source§impl SupervisorBuilder
impl SupervisorBuilder
Sourcepub fn with_task(self, name: &str, task: impl CloneableSupervisedTask) -> Self
pub fn with_task(self, name: &str, task: impl CloneableSupervisedTask) -> Self
Adds a task to the supervisor with the specified name.
Sourcepub fn with_timeout_threshold(self, threshold: Duration) -> Self
pub fn with_timeout_threshold(self, threshold: Duration) -> Self
Sets the timeout threshold for detecting task crashes.
Sourcepub fn with_heartbeat_interval(self, interval: Duration) -> Self
pub fn with_heartbeat_interval(self, interval: Duration) -> Self
Sets the interval at which tasks send heartbeats.
Sourcepub fn with_health_check_initial_delay(self, delay: Duration) -> Self
pub fn with_health_check_initial_delay(self, delay: Duration) -> Self
Sets the initial delay before health checks begin.
Sourcepub fn with_health_check_interval(self, interval: Duration) -> Self
pub fn with_health_check_interval(self, interval: Duration) -> Self
Sets the interval between health checks.
Sourcepub fn with_max_restart_attempts(self, attempts: u32) -> Self
pub fn with_max_restart_attempts(self, attempts: u32) -> Self
Sets the maximum number of restart attempts for tasks.
Sourcepub fn with_base_restart_delay(self, delay: Duration) -> Self
pub fn with_base_restart_delay(self, delay: Duration) -> Self
Sets the base delay for task restarts, used in exponential backoff.
Sourcepub fn with_task_being_stable_after(self, delay: Duration) -> Self
pub fn with_task_being_stable_after(self, delay: Duration) -> Self
Sets the delay after which a task is considered stable and healthy. When a task is considered stable, its restarts are reset to zero.
Sourcepub fn build(self) -> Supervisor
pub fn build(self) -> Supervisor
Constructs the Supervisor with the configured settings.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SupervisorBuilder
impl !RefUnwindSafe for SupervisorBuilder
impl Send for SupervisorBuilder
impl !Sync for SupervisorBuilder
impl Unpin for SupervisorBuilder
impl !UnwindSafe for SupervisorBuilder
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