pub struct Context {
pub domain_id: u32,
pub locator: String,
pub mode: SessionMode,
pub rmw: String,
pub source: ContextSource,
}Expand description
Phase 212.L.5 — resolved init context.
Returned by every init* entry point. Carries the fields the user
needs to construct an ExecutorConfig and open a session.
Fields are owned (String on hosted builds) so the Context can
outlive transient parents (env caches, parsed launch files).
Fields§
§domain_id: u32ROS 2 domain ID (ROS_DOMAIN_ID, default 0).
locator: StringMiddleware locator (NROS_LOCATOR / legacy ZENOH_LOCATOR).
mode: SessionModeSession mode (NROS_SESSION_MODE / legacy ZENOH_MODE, default Client).
rmw: StringRMW implementation hint (RMW_IMPLEMENTATION / NROS_RMW).
Empty when neither var is set. The runtime uses this to pick a
primary backend when multiple are linked; see
crate::internals::open_session.
source: ContextSourceSource of this context — useful for diagnostics + tests.
Implementations§
Source§impl Context
impl Context
Sourcepub fn config<'a>(&'a self, node_name: &'a str) -> ExecutorConfig<'a>
pub fn config<'a>(&'a self, node_name: &'a str) -> ExecutorConfig<'a>
Materialise an ExecutorConfig for a node with the given name.
The returned config borrows from self, so callers usually do:
let ctx = nros::init()?;
let cfg = ctx.config("talker");
let mut executor = nros::Executor::open(&cfg)?;