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) -> Self
pub const fn new(locator: &'a str) -> Self
Create a new configuration with the given locator.
Defaults: Client mode, domain 0, node name "node", empty namespace.
Sourcepub const fn default_const() -> Self
pub const fn default_const() -> Self
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 mode(self, mode: SessionMode) -> Self
pub const fn mode(self, mode: SessionMode) -> Self
Set the session mode.
Source§impl ExecutorConfig<'static>
impl ExecutorConfig<'static>
Sourcepub fn from_env() -> Self
pub fn from_env() -> Self
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.