Skip to main content

Executor

Struct Executor 

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

Top-level executor. One per process is the typical case.

Implementations§

Source§

impl Executor

Source

pub fn builder() -> ExecutorBuilder

Start a new builder.

Source

pub fn channel<T: Payload>( &mut self, name: &str, ) -> Result<Arc<Channel<T>>, ExecutorError>

Open or create a pub/sub channel bound to this executor’s node.

Source

pub fn service<Req, Resp>( &mut self, name: &str, ) -> Result<Arc<Service<Req, Resp>>, ExecutorError>
where Req: Payload, Resp: Payload,

Open or create a request/response service bound to this executor’s node.

Source

pub fn add( &mut self, item: impl ExecutableItem, ) -> Result<TaskId, ExecutorError>

Add an item to the executor with an auto-generated id.

Source

pub fn add_with_id( &mut self, id: impl Into<TaskId>, item: impl ExecutableItem, ) -> Result<TaskId, ExecutorError>

Add an item with a user-supplied id.

The item’s ExecutableItem::task_id override takes precedence over the caller-supplied id, which itself takes precedence over the auto-generated id assigned by Executor::add.

Source

pub fn add_chain<I, C>(&mut self, items: C) -> Result<TaskId, ExecutorError>
where I: ExecutableItem, C: IntoIterator<Item = I>,

Add a sequential chain of items. Only the head item’s declare_triggers is consulted; non-head triggers are ignored with a tracing warn.

Source

pub fn add_chain_with_id<I, C>( &mut self, id: impl Into<TaskId>, items: C, ) -> Result<TaskId, ExecutorError>
where I: ExecutableItem, C: IntoIterator<Item = I>,

Like Executor::add_chain but with a user-supplied id.

Source

pub fn stoppable(&self) -> Stoppable

Returns a Stoppable handle that is waker-aware from the moment the executor is built. Clone before calling run() — any clone taken at any time will wake the WaitSet when stop() is called.

Source

pub const fn iceoryx_node(&self) -> &Node<Service>

Borrow the underlying iceoryx2 node (escape hatch for power users).

Source

pub fn add_graph(&mut self) -> ExecutorGraphBuilder<'_>

Begin building a graph. Call .build() on the returned builder to register the graph as a task.

Source§

impl Executor

Source

pub fn run(&mut self) -> Result<(), ExecutorError>

Run the executor until Stoppable::stop is called or a task signals stop via crate::Context::stop_executor.

§Errors

Returns the first ExecutorError surfaced during dispatch:

If multiple items error in the same dispatch iteration, only the first is preserved; subsequent errors are discarded silently. To observe every error, attach an Observer and read errors via Observer::on_app_error.

Source

pub fn run_for(&mut self, max: Duration) -> Result<(), ExecutorError>

Run for at most max wall-clock duration, then return.

§Errors

Returns the first ExecutorError surfaced during dispatch:

If multiple items error in the same dispatch iteration, only the first is preserved; subsequent errors are discarded silently. To observe every error, attach an Observer and read errors via Observer::on_app_error.

Source

pub fn run_n(&mut self, n: usize) -> Result<(), ExecutorError>

Run until n full barrier-cycles (WaitSet wakeups) have completed.

§Errors

Returns the first ExecutorError surfaced during dispatch:

If multiple items error in the same dispatch iteration, only the first is preserved; subsequent errors are discarded silently. To observe every error, attach an Observer and read errors via Observer::on_app_error.

Source

pub fn run_until<F: FnMut() -> bool>( &mut self, predicate: F, ) -> Result<(), ExecutorError>

Run until predicate() returns true. Checked after each WaitSet wakeup.

§Errors

Returns the first ExecutorError surfaced during dispatch:

If multiple items error in the same dispatch iteration, only the first is preserved; subsequent errors are discarded silently. To observe every error, attach an Observer and read errors via Observer::on_app_error.

Trait Implementations§

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.