pub struct Executor { /* private fields */ }Implementations§
Source§impl Executor
impl Executor
Sourcepub fn with_context(context: Context) -> Self
pub fn with_context(context: Context) -> Self
Executor whose sockets share context (required for inproc with broker/Nodes).
Sourcepub fn with_worker_pool(max_workers: usize) -> Self
pub fn with_worker_pool(max_workers: usize) -> Self
Offload callbacks to max_workers resident threads (subscriptions,
timers, services, and action servers), subject to each callback group.
Sourcepub fn with_context_and_worker_pool(
context: Context,
max_workers: usize,
) -> Self
pub fn with_context_and_worker_pool( context: Context, max_workers: usize, ) -> Self
Like with_worker_pool, sharing context.
Sourcepub fn shutdown_handle(&self) -> ShutdownHandle
pub fn shutdown_handle(&self) -> ShutdownHandle
Sourcepub fn worker_queue_stats(&self) -> Option<QueueStats>
pub fn worker_queue_stats(&self) -> Option<QueueStats>
Waiting callback jobs and rejected submissions for the resident pool. Mutually exclusive groups expose their own additional waiting queues.
Sourcepub fn stream_hwm(&self) -> HighWaterMark
pub fn stream_hwm(&self) -> HighWaterMark
Defaults used for newly connected PUB/SUB sockets.
Sourcepub fn rpc_hwm(&self) -> HighWaterMark
pub fn rpc_hwm(&self) -> HighWaterMark
Defaults used for newly registered service workers.
Sourcepub fn action_hwm(&self) -> HighWaterMark
pub fn action_hwm(&self) -> HighWaterMark
Defaults used for newly connected action sockets.
Sourcepub fn set_stream_hwm(&mut self, hwm: HighWaterMark) -> Result<()>
pub fn set_stream_hwm(&mut self, hwm: HighWaterMark) -> Result<()>
Set HWM applied to subsequent connect_subscriber sockets.
Already-connected SUB sockets are updated in place when present.
Sourcepub fn set_rpc_hwm(&mut self, hwm: HighWaterMark) -> Result<()>
pub fn set_rpc_hwm(&mut self, hwm: HighWaterMark) -> Result<()>
Set HWM applied to subsequent register_service sockets.
Sourcepub fn set_action_hwm(&mut self, hwm: HighWaterMark) -> Result<()>
pub fn set_action_hwm(&mut self, hwm: HighWaterMark) -> Result<()>
Set HWM applied to subsequent action client / worker sockets.
pub fn connect_subscriber(&mut self, endpoint: Option<&str>) -> Result<()>
pub fn subscribe( &mut self, topic: &str, callback: MessageCallback, group: CallbackGroup, ) -> Result<SubscriptionHandle>
Sourcepub fn destroy_subscription(&mut self, handle: SubscriptionHandle) -> Result<()>
pub fn destroy_subscription(&mut self, handle: SubscriptionHandle) -> Result<()>
Remove a subscription created by subscribe.
When the last callback for a topic is removed, the SUB socket unsubscribes from that topic filter.
Sourcepub fn subscribe_typed<M, F>(
&mut self,
topic: &str,
callback: F,
group: CallbackGroup,
) -> Result<SubscriptionHandle>
pub fn subscribe_typed<M, F>( &mut self, topic: &str, callback: F, group: CallbackGroup, ) -> Result<SubscriptionHandle>
Subscribe with a protobuf-typed callback. Decode failures are skipped.
Sourcepub fn create_timer(
&mut self,
period: Duration,
callback: TimerCallback,
group: CallbackGroup,
) -> Result<TimerHandle>
pub fn create_timer( &mut self, period: Duration, callback: TimerCallback, group: CallbackGroup, ) -> Result<TimerHandle>
Create a periodic timer (ROS 2 create_timer).
First fire is after period. Concurrency follows group.
Sourcepub fn cancel_timer(&mut self, handle: TimerHandle) -> Result<()>
pub fn cancel_timer(&mut self, handle: TimerHandle) -> Result<()>
Cancel a timer created by create_timer.
pub fn connect_action_client(&mut self, endpoint: Option<&str>) -> Result<()>
pub fn send_goal( &self, action_name: &str, body: &[u8], callback: ActionMessageCallback, goal_id: Option<&str>, ) -> Result<String>
pub fn cancel_goal( &self, action_name: &str, goal_id: &str, body: &[u8], ) -> Result<()>
pub fn register_service( &mut self, service_name: &str, handler: ServiceHandler, callback_group: CallbackGroup, backend_endpoint: Option<&str>, identity: Option<&str>, hwm: Option<HighWaterMark>, ) -> Result<u64>
Sourcepub fn destroy_service(&mut self, id: u64) -> Result<()>
pub fn destroy_service(&mut self, id: u64) -> Result<()>
Disconnect and remove a service worker registered by [register_service].
pub fn register_action( &mut self, action_name: &str, handler: ActionGoalHandler, callback_group: CallbackGroup, backend_endpoint: Option<&str>, identity: Option<&str>, hwm: Option<HighWaterMark>, ) -> Result<u64>
Sourcepub fn register_action_live(
&mut self,
action_name: &str,
handler: ActionGoalLiveHandler,
callback_group: CallbackGroup,
backend_endpoint: Option<&str>,
identity: Option<&str>,
hwm: Option<HighWaterMark>,
) -> Result<u64>
pub fn register_action_live( &mut self, action_name: &str, handler: ActionGoalLiveHandler, callback_group: CallbackGroup, backend_endpoint: Option<&str>, identity: Option<&str>, hwm: Option<HighWaterMark>, ) -> Result<u64>
Register a live action worker that can publish FEEDBACK before returning RESULT.
Sourcepub fn destroy_action_server(&mut self, id: u64) -> Result<()>
pub fn destroy_action_server(&mut self, id: u64) -> Result<()>
Disconnect and remove an action worker registered by [register_action].
Sourcepub fn spin_once(&mut self, timeout: Option<Duration>) -> Result<bool>
pub fn spin_once(&mut self, timeout: Option<Duration>) -> Result<bool>
One executor step (ROS 2 spin_once): wait up to timeout, then
dispatch every currently readable registration and due timers.
Returns true if at least one socket was readable or a timer fired.
Sourcepub fn spin_some(&mut self, timeout: Option<Duration>) -> Result<()>
pub fn spin_some(&mut self, timeout: Option<Duration>) -> Result<()>
Wait up to timeout for work, then drain ready callbacks (ROS 2 spin_some).
After the first successful poll / timer fire, further iterations use a zero timeout so only already-queued messages are processed before returning.