pub struct SupervisorSpecBuilder { /* private fields */ }Expand description
Builder for SupervisorSpec.
Public constructors and setters keep returning SupervisorSpecBuilder for
chaining. Call build to consume the
builder, validate local invariants, and receive the final SupervisorSpec.
Implementations§
Source§impl SupervisorSpecBuilder
impl SupervisorSpecBuilder
Sourcepub fn root(children: Vec<ChildSpec>) -> Self
pub fn root(children: Vec<ChildSpec>) -> Self
Creates a root supervisor specification builder.
§Arguments
children: Children declared under the root supervisor.
§Returns
Returns a builder seeded with the same defaults as SupervisorSpec::root.
§Examples
use rust_supervisor::spec::supervisor_builder::SupervisorSpecBuilder;
let spec = SupervisorSpecBuilder::root(Vec::new()).build()?;
assert_eq!(spec.path.to_string(), "/");Sourcepub fn new(children: Vec<ChildSpec>) -> Self
pub fn new(children: Vec<ChildSpec>) -> Self
Creates a root supervisor specification builder.
§Arguments
children: Children declared under the root supervisor.
§Returns
Returns a builder seeded with the same defaults as SupervisorSpec::root.
Sourcepub fn path(self, path: SupervisorPath) -> Self
pub fn path(self, path: SupervisorPath) -> Self
Sourcepub fn strategy(self, strategy: SupervisionStrategy) -> Self
pub fn strategy(self, strategy: SupervisionStrategy) -> Self
Sourcepub fn config_version(self, config_version: impl Into<String>) -> Self
pub fn config_version(self, config_version: impl Into<String>) -> Self
Sourcepub fn default_restart_policy(
self,
default_restart_policy: RestartPolicy,
) -> Self
pub fn default_restart_policy( self, default_restart_policy: RestartPolicy, ) -> Self
Sourcepub fn default_backoff_policy(
self,
default_backoff_policy: BackoffPolicy,
) -> Self
pub fn default_backoff_policy( self, default_backoff_policy: BackoffPolicy, ) -> Self
Sourcepub fn default_health_policy(self, default_health_policy: HealthPolicy) -> Self
pub fn default_health_policy(self, default_health_policy: HealthPolicy) -> Self
Sourcepub fn tree_shutdown(self, tree_shutdown: TreeShutdownPolicy) -> Self
pub fn tree_shutdown(self, tree_shutdown: TreeShutdownPolicy) -> Self
Sourcepub fn supervisor_failure_limit(self, supervisor_failure_limit: u32) -> Self
pub fn supervisor_failure_limit(self, supervisor_failure_limit: u32) -> Self
Sourcepub fn restart_limit(self, restart_limit: RestartLimit) -> Self
pub fn restart_limit(self, restart_limit: RestartLimit) -> Self
Sourcepub fn without_restart_limit(self) -> Self
pub fn without_restart_limit(self) -> Self
Sourcepub fn escalation_policy(self, escalation_policy: EscalationPolicy) -> Self
pub fn escalation_policy(self, escalation_policy: EscalationPolicy) -> Self
Sets the supervisor-level fallback escalation policy.
The selected policy is used when a child-level or group-level execution
plan does not define its own escalation policy. Root supervisors do not
have a parent supervisor at runtime, so EscalateToParent is only a
configured planning and diagnostic label for root supervisors.
§Arguments
escalation_policy: Fallback escalation policy applied at supervisor level.
§Returns
Returns the builder for chaining.
Sourcepub fn without_escalation_policy(self) -> Self
pub fn without_escalation_policy(self) -> Self
Sourcepub fn group_strategies(self, group_strategies: Vec<GroupStrategy>) -> Self
pub fn group_strategies(self, group_strategies: Vec<GroupStrategy>) -> Self
Sourcepub fn group_strategy(self, group_strategy: GroupStrategy) -> Self
pub fn group_strategy(self, group_strategy: GroupStrategy) -> Self
Sourcepub fn group_configs(self, group_configs: Vec<GroupConfig>) -> Self
pub fn group_configs(self, group_configs: Vec<GroupConfig>) -> Self
Sourcepub fn group_config(self, group_config: GroupConfig) -> Self
pub fn group_config(self, group_config: GroupConfig) -> Self
Sourcepub fn group_dependencies(
self,
group_dependencies: Vec<GroupDependencyEdge>,
) -> Self
pub fn group_dependencies( self, group_dependencies: Vec<GroupDependencyEdge>, ) -> Self
Sourcepub fn group_dependency(self, group_dependency: GroupDependencyEdge) -> Self
pub fn group_dependency(self, group_dependency: GroupDependencyEdge) -> Self
Sourcepub fn severity_defaults(
self,
severity_defaults: HashMap<TaskRole, SeverityClass>,
) -> Self
pub fn severity_defaults( self, severity_defaults: HashMap<TaskRole, SeverityClass>, ) -> Self
Sourcepub fn severity_default(
self,
task_role: TaskRole,
severity: SeverityClass,
) -> Self
pub fn severity_default( self, task_role: TaskRole, severity: SeverityClass, ) -> Self
Sourcepub fn without_severity_default(self, task_role: TaskRole) -> Self
pub fn without_severity_default(self, task_role: TaskRole) -> Self
Sourcepub fn child_strategy_overrides(
self,
child_strategy_overrides: Vec<ChildStrategyOverride>,
) -> Self
pub fn child_strategy_overrides( self, child_strategy_overrides: Vec<ChildStrategyOverride>, ) -> Self
Sourcepub fn child_strategy_override(
self,
child_strategy_override: ChildStrategyOverride,
) -> Self
pub fn child_strategy_override( self, child_strategy_override: ChildStrategyOverride, ) -> Self
Sourcepub fn dynamic_supervisor_policy(
self,
dynamic_supervisor_policy: DynamicSupervisorPolicy,
) -> Self
pub fn dynamic_supervisor_policy( self, dynamic_supervisor_policy: DynamicSupervisorPolicy, ) -> Self
Sourcepub fn control_channel_capacity(self, control_channel_capacity: usize) -> Self
pub fn control_channel_capacity(self, control_channel_capacity: usize) -> Self
Sourcepub fn event_channel_capacity(self, event_channel_capacity: usize) -> Self
pub fn event_channel_capacity(self, event_channel_capacity: usize) -> Self
Sourcepub fn backpressure_config(
self,
backpressure_config: BackpressureConfig,
) -> Self
pub fn backpressure_config( self, backpressure_config: BackpressureConfig, ) -> Self
Sourcepub fn meltdown_policy(self, meltdown_policy: MeltdownPolicy) -> Self
pub fn meltdown_policy(self, meltdown_policy: MeltdownPolicy) -> Self
Sourcepub fn failure_window_config(
self,
failure_window_config: FailureWindowConfig,
) -> Self
pub fn failure_window_config( self, failure_window_config: FailureWindowConfig, ) -> Self
Sourcepub fn restart_budget_config(
self,
restart_budget_config: RestartBudgetConfig,
) -> Self
pub fn restart_budget_config( self, restart_budget_config: RestartBudgetConfig, ) -> Self
Sourcepub fn pipeline_journal_capacity(self, pipeline_journal_capacity: usize) -> Self
pub fn pipeline_journal_capacity(self, pipeline_journal_capacity: usize) -> Self
Sourcepub fn pipeline_subscriber_capacity(
self,
pipeline_subscriber_capacity: usize,
) -> Self
pub fn pipeline_subscriber_capacity( self, pipeline_subscriber_capacity: usize, ) -> Self
Sourcepub fn concurrent_restart_limit(self, concurrent_restart_limit: u32) -> Self
pub fn concurrent_restart_limit(self, concurrent_restart_limit: u32) -> Self
Sourcepub fn metrics_enabled(self, metrics_enabled: bool) -> Self
pub fn metrics_enabled(self, metrics_enabled: bool) -> Self
Sourcepub fn audit_enabled(self, audit_enabled: bool) -> Self
pub fn audit_enabled(self, audit_enabled: bool) -> Self
Sourcepub fn build(self) -> Result<SupervisorSpec, SupervisorError>
pub fn build(self) -> Result<SupervisorSpec, SupervisorError>
Builds and validates the supervisor specification.
§Arguments
This function has no arguments.
§Returns
Returns the constructed SupervisorSpec when local invariants pass.
§Errors
Returns SupervisorError when validation fails.
§Examples
use rust_supervisor::spec::supervisor_builder::SupervisorSpecBuilder;
let spec = SupervisorSpecBuilder::root(Vec::new())
.config_version("demo")
.build()?;
assert_eq!(spec.config_version, "demo");use rust_supervisor::spec::supervisor::SupervisorSpec;
use rust_supervisor::spec::supervisor_builder::SupervisorSpecBuilder;
let builder = SupervisorSpecBuilder::root(Vec::new());
let _spec: SupervisorSpec = builder;Trait Implementations§
Source§impl Clone for SupervisorSpecBuilder
impl Clone for SupervisorSpecBuilder
Source§fn clone(&self) -> SupervisorSpecBuilder
fn clone(&self) -> SupervisorSpecBuilder
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 !RefUnwindSafe for SupervisorSpecBuilder
impl !UnwindSafe for SupervisorSpecBuilder
impl Freeze for SupervisorSpecBuilder
impl Send for SupervisorSpecBuilder
impl Sync for SupervisorSpecBuilder
impl Unpin for SupervisorSpecBuilder
impl UnsafeUnpin for SupervisorSpecBuilder
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,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi Quirk value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);