Skip to main content

set_custom_transport

Function set_custom_transport 

Source
pub unsafe fn set_custom_transport(
    ops: Option<NrosTransportOps>,
) -> Result<(), TransportError>
Expand description

Phase 115.A — register a custom transport vtable. Must be called before the first Rmw::open (or nros_support_init from the C surface). v1 leaves enforcement of “before init” to backend code — they reject re-registration with NROS_RMW_RET_ALREADY_INIT after Rmw::open succeeds.

Pass None to clear a previously-registered vtable (e.g. for teardown in tests).

Returns Err(TransportError::IncompatibleAbi) when ops.is_some() but abi_version != NROS_TRANSPORT_OPS_ABI_VERSION_V1. C / C++ wrappers map this to NROS_RMW_RET_INCOMPATIBLE_ABI.

§Safety

The four fn pointers in ops must follow the threading contract documented on NrosTransportOps — no concurrent read/write, no ISR invocation, user_data outlives the transport’s active period.