pub struct RuntimeCtx<'a> {
pub params: &'a [(&'a str, &'a str)],
pub remaps: &'a [(&'a str, &'a str)],
pub env: &'a [(&'a str, &'a str)],
pub node_identity: Option<(&'static str, &'static str)>,
pub runtime: &'a mut dyn NodeDispatchRuntime,
}Expand description
Runtime context handed to BoardEntry::run(setup).
All three overlay slices may be empty. A board’s launch overlay
typically populates params + remaps; env is rarely set on
embedded.
Fields§
§params: &'a [(&'a str, &'a str)]<param name=… value=…/> from launch XML, or
-p name:=value CLI overrides.
remaps: &'a [(&'a str, &'a str)]Topic / service / action remaps: (from, to).
env: &'a [(&'a str, &'a str)]Environment-style key/value pairs (mostly POSIX). Empty on embedded boards.
node_identity: Option<(&'static str, &'static str)>Phase 268 W1 — launch-injected node identity (name, namespace) for
the NEXT register() call, set by nros::main! per component before
each <pkg>::register(runtime)? call. None → the node’s own
create_node(NodeOptions::new("…")) default stands (backward-compatible).
Reset to None after every register in the self-bringup arm so a prior
component’s identity never leaks into the next (RFC-0046).
runtime: &'a mut dyn NodeDispatchRuntimeNode runtime sink. BoardEntry::run populates this with
the live ExecutorNodeRuntime-backed impl before invoking
the user setup closure. The codegen-emitted
run_plan(runtime) body calls <pkg>::register(runtime) once per Node
pkg, which installs through runtime.executor_handle() +
nros::install_node_typed (Phase 258, Track 2).
Defaults to a NullNodeRuntime when the context is
built via RuntimeCtx::with_runtime. That sink errors
every call so test fixtures that forget to wire a real runtime
fail loud.
Implementations§
Source§impl<'a> RuntimeCtx<'a>
impl<'a> RuntimeCtx<'a>
Sourcepub fn with_runtime(runtime: &'a mut dyn NodeDispatchRuntime) -> Self
pub fn with_runtime(runtime: &'a mut dyn NodeDispatchRuntime) -> Self
Build a RuntimeCtx with no params / remaps / env and the
given runtime sink. The common shape BoardEntry::run
constructs after opening its executor.
For test fixtures that don’t need a populated runtime, pass a
&mut NullNodeRuntime — every call against the sink
returns Err(()), surfacing the missing wiring.
Sourcepub fn new(
runtime: &'a mut dyn NodeDispatchRuntime,
params: &'a [(&'a str, &'a str)],
remaps: &'a [(&'a str, &'a str)],
env: &'a [(&'a str, &'a str)],
) -> Self
pub fn new( runtime: &'a mut dyn NodeDispatchRuntime, params: &'a [(&'a str, &'a str)], remaps: &'a [(&'a str, &'a str)], env: &'a [(&'a str, &'a str)], ) -> Self
Build a RuntimeCtx with explicit overlay slices + runtime
sink (Phase 212.N.7 step-3.2).
Sourcepub fn apply_lifecycle(&mut self, autostart: u8) -> Result<(), ()>
pub fn apply_lifecycle(&mut self, autostart: u8) -> Result<(), ()>
Phase 264 W2 — register lifecycle services + drive autostart on the runtime
sink (forwards to NodeDispatchRuntime::apply_lifecycle). nros::main!
emits this after the per-node register calls when system.toml declares
[lifecycle]. No-op unless nros is built with lifecycle-services.
Sourcepub fn apply_param_services(
&mut self,
params: &[(&str, &str)],
) -> Result<(), ()>
pub fn apply_param_services( &mut self, params: &[(&str, &str)], ) -> Result<(), ()>
Phase 264 W4b — register the ROS 2 parameter services + seed the volatile
param store from the launch-baked <param> initials (forwards to
NodeDispatchRuntime::apply_param_services). nros::main! emits this after
the per-node register calls when system.toml declares [param_services].
No-op unless nros is built with param-services.
Sourcepub fn param(&self, name: &str) -> Option<&'a str>
pub fn param(&self, name: &str) -> Option<&'a str>
Lookup a param by name; first match wins. Linear scan because the slice is typically small (≤ a dozen entries).