pub struct Executor { /* private fields */ }Expand description
Top-level executor. One per process is the typical case.
Implementations§
Source§impl Executor
impl Executor
Sourcepub fn builder() -> ExecutorBuilder
pub fn builder() -> ExecutorBuilder
Start a new builder.
Sourcepub fn channel<T: Payload>(
&mut self,
name: &str,
) -> Result<Arc<Channel<T>>, ExecutorError>
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.
Sourcepub fn service<Req, Resp>(
&mut self,
name: &str,
) -> Result<Arc<Service<Req, Resp>>, ExecutorError>
pub fn service<Req, Resp>( &mut self, name: &str, ) -> Result<Arc<Service<Req, Resp>>, ExecutorError>
Open or create a request/response service bound to this executor’s node.
Sourcepub fn add(
&mut self,
item: impl ExecutableItem,
) -> Result<TaskId, ExecutorError>
pub fn add( &mut self, item: impl ExecutableItem, ) -> Result<TaskId, ExecutorError>
Add an item to the executor with an auto-generated id.
Sourcepub fn add_with_id(
&mut self,
id: impl Into<TaskId>,
item: impl ExecutableItem,
) -> Result<TaskId, ExecutorError>
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.
Sourcepub fn add_chain<I, C>(&mut self, items: C) -> Result<TaskId, ExecutorError>where
I: ExecutableItem,
C: IntoIterator<Item = I>,
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.
Sourcepub 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>,
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.
Sourcepub fn stoppable(&self) -> Stoppable
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.
Sourcepub const fn iceoryx_node(&self) -> &Node<Service>
pub const fn iceoryx_node(&self) -> &Node<Service>
Borrow the underlying iceoryx2 node (escape hatch for power users).
Sourcepub fn add_graph(&mut self) -> ExecutorGraphBuilder<'_>
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
impl Executor
Sourcepub fn run(&mut self) -> Result<(), ExecutorError>
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:
ExecutorError::Itemif any item returnsError panics.ExecutorError::Iceoryx2if aWaitSetoperation fails.ExecutorError::AlreadyRunningif the executor is already running.
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.
Sourcepub fn run_for(&mut self, max: Duration) -> Result<(), ExecutorError>
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:
ExecutorError::Itemif any item returnsError panics.ExecutorError::Iceoryx2if aWaitSetoperation fails.ExecutorError::AlreadyRunningif the executor is already running.
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.
Sourcepub fn run_n(&mut self, n: usize) -> Result<(), ExecutorError>
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:
ExecutorError::Itemif any item returnsError panics.ExecutorError::Iceoryx2if aWaitSetoperation fails.ExecutorError::AlreadyRunningif the executor is already running.
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.
Sourcepub fn run_until<F: FnMut() -> bool>(
&mut self,
predicate: F,
) -> Result<(), ExecutorError>
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:
ExecutorError::Itemif any item returnsError panics.ExecutorError::Iceoryx2if aWaitSetoperation fails.ExecutorError::AlreadyRunningif the executor is already running.
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.