pub struct ExecutorConfig<'a> {
pub locator: &'a str,
pub mode: SessionMode,
pub domain_id: u32,
pub node_name: &'a str,
pub namespace: &'a str,
}Expand description
Configuration for opening an embedded executor session.
Provides a backend-agnostic builder for configuring the middleware
connection. The active Cargo feature (rmw-zenoh, rmw-xrce, or
rmw-cffi) determines which backend is used.
§Example
use nros::prelude::*;
let config = ExecutorConfig::new("tcp/127.0.0.1:7447")
.node_name("talker")
.domain_id(0);
let mut executor: Executor = Executor::open(&config)?;Fields§
§locator: &'a strMiddleware-specific connection string.
mode: SessionModeSession mode (client or peer).
domain_id: u32ROS 2 domain ID.
node_name: &'a strNode name.
namespace: &'a strNode namespace.
Implementations§
Source§impl<'a> ExecutorConfig<'a>
impl<'a> ExecutorConfig<'a>
Sourcepub const fn new(locator: &'a str) -> ExecutorConfig<'a>
pub const fn new(locator: &'a str) -> ExecutorConfig<'a>
Create a new configuration with the given locator.
Defaults: Client mode, domain 0, node name "node", empty namespace.
Sourcepub const fn default_const() -> ExecutorConfig<'a>
pub const fn default_const() -> ExecutorConfig<'a>
Phase 104.C.3.3.b — Default-style constructor with an
empty locator. Most users want ExecutorConfig::from_env()
to pick up ZENOH_LOCATOR / ROS_DOMAIN_ID; this is the
rclcpp-NodeOptions{} shape for callers that set every
field explicitly via the chaining setters.
Source§impl<'a> ExecutorConfig<'a>
impl<'a> ExecutorConfig<'a>
Sourcepub const fn domain_id(self, id: u32) -> ExecutorConfig<'a>
pub const fn domain_id(self, id: u32) -> ExecutorConfig<'a>
Set the ROS 2 domain ID.
Sourcepub const fn node_name(self, name: &'a str) -> ExecutorConfig<'a>
pub const fn node_name(self, name: &'a str) -> ExecutorConfig<'a>
Set the node name.
Sourcepub const fn namespace(self, ns: &'a str) -> ExecutorConfig<'a>
pub const fn namespace(self, ns: &'a str) -> ExecutorConfig<'a>
Set the node namespace.
Sourcepub const fn mode(self, mode: SessionMode) -> ExecutorConfig<'a>
pub const fn mode(self, mode: SessionMode) -> ExecutorConfig<'a>
Set the session mode.
Source§impl ExecutorConfig<'static>
impl ExecutorConfig<'static>
Sourcepub fn from_env() -> ExecutorConfig<'static>
pub fn from_env() -> ExecutorConfig<'static>
Create a configuration from environment variables.
Reads:
NROS_LOCATOR— Middleware locator (default:"tcp/127.0.0.1:7447"). Legacy nameZENOH_LOCATORis accepted with a deprecation warning.ROS_DOMAIN_ID— ROS 2 domain ID (default:0).NROS_SESSION_MODE— Session mode:"client"or"peer"(default:"client"). Legacy nameZENOH_MODEis accepted with a deprecation warning.
Env-var values are cached in a process-global OnceLock on the
first call and reused for the process lifetime — repeated calls
do NOT re-read the environment and do NOT accrete memory. The
returned &'static str fields point into the cache.