Skip to main content

ExecutorConfig

Struct ExecutorConfig 

Source
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 str

Middleware-specific connection string.

§mode: SessionMode

Session mode (client or peer).

§domain_id: u32

ROS 2 domain ID.

§node_name: &'a str

Node name.

§namespace: &'a str

Node namespace.

Implementations§

Source§

impl<'a> ExecutorConfig<'a>

Source

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.

Source

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>

Source

pub const fn domain_id(self, id: u32) -> ExecutorConfig<'a>

Set the ROS 2 domain ID.

Source

pub const fn node_name(self, name: &'a str) -> ExecutorConfig<'a>

Set the node name.

Source

pub const fn namespace(self, ns: &'a str) -> ExecutorConfig<'a>

Set the node namespace.

Source

pub const fn mode(self, mode: SessionMode) -> ExecutorConfig<'a>

Set the session mode.

Source§

impl ExecutorConfig<'static>

Source

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 name ZENOH_LOCATOR is 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 name ZENOH_MODE is 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.

Trait Implementations§

Source§

impl Default for ExecutorConfig<'_>

Source§

fn default() -> ExecutorConfig<'_>

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for ExecutorConfig<'a>

§

impl<'a> RefUnwindSafe for ExecutorConfig<'a>

§

impl<'a> Send for ExecutorConfig<'a>

§

impl<'a> Sync for ExecutorConfig<'a>

§

impl<'a> Unpin for ExecutorConfig<'a>

§

impl<'a> UnsafeUnpin for ExecutorConfig<'a>

§

impl<'a> UnwindSafe for ExecutorConfig<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.