nros rmw-cffi
C vtable for plugging a third-party RMW backend into nros
Loading...
Searching...
No Matches
Data Fields
rmw_mut_byte_span_t Struct Reference

#include <rmw_entity.h>

Data Fields

size_t capacity
 
uint8_t * data
 
size_t len
 

Detailed Description

Room to WRITE — phase-406 W2.

This is upstream's rmw_serialized_message_t MINUS THE ALLOCATOR. That is not a coincidence and it is the whole argument: upstream's is an rcutils_uint8_array_t, {buffer, buffer_length, buffer_capacity, allocator}, and this ABI declined it because of the last field. Drop that field and the remaining three are exactly what a caller-owned destination needs, so the "carries an allocator" objection does not transfer to this.

capacity is a LIMIT (in) and len is a RESULT (out). They are separate fields rather than one overloaded len because "capacity on the way in, length on the way out" is the snprintf ambiguity, and it is a bug generator.

PASSED BY POINTER, always. The callee must set len, and a by-value copy would discard it — code that compiles, runs, and yields zero-length messages.

Field Documentation

◆ capacity

size_t rmw_mut_byte_span_t::capacity

In: bytes available at data.

◆ data

uint8_t* rmw_mut_byte_span_t::data

◆ len

size_t rmw_mut_byte_span_t::len

Out: bytes actually written. Undefined on failure.


The documentation for this struct was generated from the following file: