Skip to main content

ExecutorBuilder

Struct ExecutorBuilder 

Source
pub struct ExecutorBuilder { /* private fields */ }
Expand description

Builder for Executor.

Implementations§

Source§

impl ExecutorBuilder

Source

pub const fn worker_threads(self, n: usize) -> Self

Number of worker threads. 0 → inline (no pool). Default → physical cores.

Source

pub fn observer(self, obs: Arc<dyn Observer>) -> Self

Attach a lifecycle observer. If not called, a no-op observer is used.

Source

pub fn monitor(self, mon: Arc<dyn ExecutionMonitor>) -> Self

Attach an execution monitor. If not called, a no-op monitor is used.

Source

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).

Source

pub const fn stats_window(self, samples: u32) -> Self

Sliding-window size (samples) for percentile / min-max / jitter / lateness aggregation (REQ_0100). Default 1024.

Source

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.

Source

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.

Source

pub fn cyclic_clock(self, clock: Arc<dyn CyclicClock>) -> Self

Override the scheduling clock (default MonotonicCyclicClock). Distinct from clock (telemetry) — see CyclicClock.

Source

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.

Source

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.

Source

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).

Trait Implementations§

Source§

impl Default for ExecutorBuilder

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.