pub struct ExecutorBuilder { /* private fields */ }Expand description
Builder for Executor.
Implementations§
Source§impl ExecutorBuilder
impl ExecutorBuilder
Sourcepub const fn worker_threads(self, n: usize) -> Self
pub const fn worker_threads(self, n: usize) -> Self
Number of worker threads. 0 → inline (no pool). Default → physical
cores.
Sourcepub fn observer(self, obs: Arc<dyn Observer>) -> Self
pub fn observer(self, obs: Arc<dyn Observer>) -> Self
Attach a lifecycle observer. If not called, a no-op observer is used.
Sourcepub fn monitor(self, mon: Arc<dyn ExecutionMonitor>) -> Self
pub fn monitor(self, mon: Arc<dyn ExecutionMonitor>) -> Self
Attach an execution monitor. If not called, a no-op monitor is used.
Sourcepub const fn iteration_budget(self, dur: Duration) -> Self
pub const fn iteration_budget(self, dur: Duration) -> Self
Configure the executor-wide iteration budget. Any task whose
execute() exceeds dur transitions the executor to Faulted
(REQ_0071). Default: unset (no executor-wide check).
Sourcepub const fn stats_window(self, samples: u32) -> Self
pub const fn stats_window(self, samples: u32) -> Self
Sliding-window size (samples) for percentile / min-max / jitter /
lateness aggregation (REQ_0100). Default 1024.
Sourcepub fn clock(self, clock: Arc<dyn MonotonicClock>) -> Self
pub fn clock(self, clock: Arc<dyn MonotonicClock>) -> Self
Substitute the telemetry time source. Defaults to SystemClock.
Pass a MockClock clone to drive took / jitter /
lateness from scripted instants, making timing assertions exact and
independent of the host scheduler. The clock affects telemetry only —
scheduling, run-mode deadlines and fault detection always use the real
monotonic clock.
Sourcepub const fn dispatch_mode(self, mode: DispatchMode) -> Self
pub const fn dispatch_mode(self, mode: DispatchMode) -> Self
Select cyclic dispatch timing (default DispatchMode::Grid). Legacy is
the pre-REQ_0268 attach_interval path, retained only until the Pi A/B.
Sourcepub fn cyclic_clock(self, clock: Arc<dyn CyclicClock>) -> Self
pub fn cyclic_clock(self, clock: Arc<dyn CyclicClock>) -> Self
Override the scheduling clock (default MonotonicCyclicClock). Distinct
from clock (telemetry) — see CyclicClock.
Sourcepub fn worker_attrs(self, attrs: ThreadAttributes) -> Self
pub fn worker_attrs(self, attrs: ThreadAttributes) -> Self
Set thread attributes (name prefix, CPU affinity, scheduling priority)
for worker threads. Has no effect when worker_threads is 0 (inline
mode). Requires the thread_attrs feature for non-default settings.
Sourcepub fn on_fatal(
self,
handler: impl Fn(&FatalContext) + Send + Sync + 'static,
) -> Self
pub fn on_fatal( self, handler: impl Fn(&FatalContext) + Send + Sync + 'static, ) -> Self
Register a best-effort last-gasp handler invoked once on the fail-fast
path immediately before std::process::abort().
Contract: runs over known-unsound executor state — MUST NOT touch
executor internals; a panic inside the handler routes straight to
abort().
The handler is expected to be time-bounded (the caller’s responsibility); no runtime deadline is imposed.
Observer / monitor containment carve-out: the panic containment
described in the executor documentation covers only a user item’s
execute() call. Panics that originate in framework-invoked user
callbacks that run outside that inner catch — such as
Observer methods (e.g. on_app_error,
on_task_fault) and ExecutionMonitor
methods (e.g. post_execute) — escape to this fail-fast boundary and
cause abort(). Those callbacks must therefore be treated as
non-panicking by the implementor. See REQ_0123.
If not called, a no-op handler is used and abort() is still reached
after any unrecoverable fault.
Sourcepub fn build(self) -> Result<Executor, ExecutorError>
pub fn build(self) -> Result<Executor, ExecutorError>
Build the Executor. Creates a fresh iceoryx2 node and wires up the
internal stop-event service so that any Stoppable clone (taken before
or after run()) will wake the WaitSet when stop() is called.
§Panics
Panics if the internally-generated stop-event service name exceeds the iceoryx2 service name length limit (this cannot happen under normal use because the name is derived from the process id and a monotonic counter).