pub trait ExecutorConfigEnvExt {
// Required method
fn from_env() -> ExecutorConfig<'static>;
}Expand description
ExecutorConfig::from_env(), as an extension trait.
issue 0687 — this was an inherent method on ExecutorConfig, which is
defined in nros-node; an inherent method cannot be moved to another crate
and keep its spelling, and the spelling is what ~26 call sites (most of them
user-facing native examples) are written against. A trait keeps
ExecutorConfig::from_env() working wherever it is in scope — the
prelude carries it, so a consumer that already writes
use nros::prelude::* changes nothing at all.
Required Methods§
Sourcefn from_env() -> ExecutorConfig<'static>
fn from_env() -> ExecutorConfig<'static>
Create a configuration from environment variables.
Reads:
NROS_LOCATOR— Middleware locator. Unset ⇒ empty (issue 0330: the active RMW backend applies its own default; e.g. zenoh dialsnros_rmw_zenoh::DEFAULT_LOCATOR). Legacy nameZENOH_LOCATORis accepted with a deprecation warning.ROS_DOMAIN_ID— ROS 2 domain ID (default:0).NROS_SESSION_MODE—"client"or"peer"(default:"client"). Legacy nameZENOH_MODEis accepted with a deprecation warning.NROS_RMW— the backend selector, throughrmw_selector. issue 0687:Executor::openused to read this itself; it now takesExecutorConfig::rmw, so a config built here still selects the backend the user named.
String values are cached in a process-global OnceLock on the first
call and reused for the process lifetime — repeated calls do NOT
accrete memory, and the returned &'static str fields point into that
cache. Presence and the domain id are read live, so a caller that
changes the environment between calls sees the change.
Panics on a malformed or out-of-range $ROS_DOMAIN_ID, like
resolve_hosted and the C / C++ entries. A boot identity that cannot
be resolved is a configuration error; the alternative is a node silently
running on domain 0, which is what issue #206 removed everywhere else.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".