Skip to main content

nros_node/executor/
mod.rs

1//! Embedded executor with build-time configured arena.
2//!
3//! Provides `Executor` and `Node` that work with the compile-time
4//! selected RMW backend (zenoh, XRCE-DDS, or C FFI).
5//!
6//! # Example
7//!
8//! ```ignore
9//! use nros_node::executor::*;
10//! use std_msgs::msg::Int32;
11//!
12//! let config = ExecutorConfig::from_env().node_name("my_node");
13//! let mut executor = Executor::open(&config)?;
14//! let mut node = executor.create_node("my_node")?;
15//!
16//! let publisher = node.create_publisher::<Int32>("/chatter")?;
17//! publisher.publish(&Int32 { data: 42 })?;
18//!
19//! loop {
20//!     executor.spin_once(core::time::Duration::from_millis(10));
21//! }
22//! ```
23
24#[cfg(any(has_rmw, test))]
25pub mod action_core;
26#[cfg(any(has_rmw, test))]
27pub(crate) mod activator;
28#[cfg(any(has_rmw, test))]
29mod arena;
30#[cfg(any(has_rmw, test))]
31pub(crate) mod dispatcher;
32#[cfg(any(has_rmw, test))]
33mod handles;
34#[cfg(feature = "std")]
35pub mod handoff;
36#[cfg(any(has_rmw, test))]
37pub mod monitor;
38#[cfg(any(has_rmw, test))]
39mod node;
40#[cfg(any(has_rmw, test))]
41pub mod node_record;
42#[cfg(any(has_rmw, test))]
43mod node_wake;
44#[cfg(any(has_rmw, test))]
45pub(crate) mod ready_set;
46pub mod sched_context;
47#[cfg(any(has_rmw, test))]
48mod spin;
49#[cfg(any(has_rmw, test))]
50pub(crate) mod spsc_ring;
51#[cfg(any(has_rmw, test))]
52mod storage;
53#[cfg(any(has_rmw, test))]
54pub(crate) mod triple_buffer;
55mod types;
56#[cfg(any(has_rmw, test))]
57mod wake_alloc;
58#[cfg(all(any(has_rmw, test), feature = "wake-latency-probe"))]
59pub mod wake_probe;
60
61#[cfg(any(has_rmw, test))]
62pub mod action;
63
64// MockSession-based tests. Disabled when any rmw-* feature is active because
65// feature unification under `cargo test --workspace` flips `ConcreteSession`
66// to a real backend handle (e.g. UorbSession when rmw-uorb is on transitively
67// via the workspace), breaking the type signatures the tests expect.
68#[cfg(all(test, not(feature = "rmw-cffi")))]
69mod tests;
70
71// Flat re-exports so users write `executor::Executor` etc.
72#[cfg(any(has_rmw, test))]
73pub use action::{
74    ActionClientRawHandle, ActionServerHandle, ActionServerRawHandle, RawActionClientSpec,
75    RawActionServerSpec,
76};
77#[cfg(any(has_rmw, test))]
78pub use action_core::{ActionClientCore, ActionServerCore, RawActiveGoal};
79#[cfg(any(has_rmw, test))]
80pub use handles::*;
81#[cfg(any(has_rmw, test))]
82pub use node::{CallbackGroup, NodeHandle};
83#[cfg(any(has_rmw, test))]
84pub use node_record::{NodeBuilder, NodeId, NodeRecord};
85#[cfg(any(has_rmw, test))]
86pub use spin::Executor;
87#[cfg(any(has_rmw, test))]
88pub use spin::SessionHandle;
89#[cfg(all(any(has_rmw, test), feature = "rmw-cffi"))]
90pub use spin::SessionSpec;
91#[cfg(any(has_rmw, test))]
92pub use storage::{
93    ExecutorInlineStorage, ExecutorSizing, executor_storage_layout, executor_storage_u64_len,
94};
95pub use types::*;