Skip to main content

Rmw

Trait Rmw 

Source
pub trait Rmw {
    type Session: Session;
    type Error: Debug;

    // Required method
    fn open(self, config: &RmwConfig<'_>) -> Result<Self::Session, Self::Error>;
}
Expand description

Factory trait for compile-time middleware selection.

Embedded crates select a backend via feature flag:

ⓘ
#[cfg(feature = "rmw-cffi")]
type DefaultRmw = nros_rmw_cffi::CffiRmw;

Each backend provides its own Rmw implementation that bridges from the middleware-agnostic RmwConfig to backend-specific initialization.

Phase 84.E2: open consumes self. Backends carry their own configuration (agent addresses, serial ports, TLS CA slots) inside the factory value and hand that over to the session at open time. In-tree, every backend sits behind the C vtable, so the one production impl is CffiRmw, spelled CffiRmw::default().open(&config).

Required Associated Types§

Source

type Session: Session

Session type returned by open

Source

type Error: Debug

Error type for session creation

Required Methods§

Source

fn open(self, config: &RmwConfig<'_>) -> Result<Self::Session, Self::Error>

Open a new middleware session with the given configuration.

The backend maps RmwConfig fields to its own connection parameters (e.g., zenoh locator and session mode, XRCE-DDS agent address). Any backend-specific pre-open state stored on self (e.g. configured agent IP / port) is moved into the returned Session.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§