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))]
37mod node;
38#[cfg(any(has_rmw, test))]
39pub mod node_record;
40#[cfg(any(has_rmw, test))]
41mod node_wake;
42#[cfg(any(has_rmw, test))]
43pub(crate) mod ready_set;
44#[cfg(any(has_rmw, test))]
45pub mod sched_context;
46#[cfg(any(has_rmw, test))]
47mod spin;
48#[cfg(any(has_rmw, test))]
49pub(crate) mod spsc_ring;
50#[cfg(any(has_rmw, test))]
51pub(crate) mod triple_buffer;
52mod types;
53#[cfg(any(has_rmw, test))]
54mod wake_alloc;
55#[cfg(all(any(has_rmw, test), feature = "wake-latency-probe"))]
56pub mod wake_probe;
57
58#[cfg(any(has_rmw, test))]
59pub mod action;
60
61// MockSession-based tests. Disabled when any rmw-* feature is active because
62// feature unification under `cargo test --workspace` flips `ConcreteSession`
63// to a real backend handle (e.g. UorbSession when rmw-uorb is on transitively
64// via the workspace), breaking the type signatures the tests expect.
65#[cfg(all(test, not(feature = "rmw-cffi")))]
66mod tests;
67
68// Flat re-exports so users write `executor::Executor` etc.
69#[cfg(any(has_rmw, test))]
70pub use action::{
71    ActionClientRawHandle, ActionServerHandle, ActionServerRawHandle, RawActionClientSpec,
72    RawActionServerSpec,
73};
74#[cfg(any(has_rmw, test))]
75pub use action_core::{ActionClientCore, ActionServerCore, RawActiveGoal};
76#[cfg(any(has_rmw, test))]
77pub use handles::*;
78#[cfg(any(has_rmw, test))]
79pub use node::NodeHandle;
80#[cfg(any(has_rmw, test))]
81pub use node_record::{NodeBuilder, NodeId, NodeRecord};
82#[cfg(any(has_rmw, test))]
83pub use spin::Executor;
84#[cfg(any(has_rmw, test))]
85pub use spin::SessionHandle;
86#[cfg(all(any(has_rmw, test), feature = "rmw-cffi"))]
87pub use spin::SessionSpec;
88pub use types::*;