Skip to main content

error_from_ret

Function error_from_ret 

Source
pub fn error_from_ret(ret: NrosRmwRet) -> TransportError
Expand description

Map a nros_rmw_ret_t returned by a C-side vtable function back to a TransportError for the Rust caller. Inverse of ret_from_error — used when nros-rmw-cffi’s CffiSession etc. receive a code from the registered C backend.

NROS_RMW_RET_OK is mapped to TransportError::Backend("ok") as a programming-error sentinel; callers should branch on the success path before calling this. Unknown negative codes collapse to the generic TransportError::Backend("unknown rmw_ret_t") so a future constant added to the C header degrades gracefully on the Rust side.