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 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.
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 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).