#[repr(C)]pub struct rmw_mut_byte_span_t {
pub data: *mut u8,
pub capacity: usize,
pub len: usize,
}Expand 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.
Fields§
§data: *mut u8§capacity: usizeIn: bytes available at data.
len: usizeOut: bytes actually written.
On NROS_RMW_RET_BUFFER_TOO_SMALL from any of the three TAKE slots —
the subscription take (issue 1612), the service take_request and
the client take_response (issue 1632) — it is the size the refused
sample, request or reply NEEDED, or NROS_RMW_TAKE_LEN_UNKNOWN when
the backend cannot know it. The caller pre-sets it to that value on
all three. Undefined on every other failure.
Trait Implementations§
Source§impl Clone for rmw_mut_byte_span_t
impl Clone for rmw_mut_byte_span_t
Source§fn clone(&self) -> rmw_mut_byte_span_t
fn clone(&self) -> rmw_mut_byte_span_t
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more