Skip to main content

TypedSubscriptionCallback

Type Alias TypedSubscriptionCallback 

Source
pub type TypedSubscriptionCallback = unsafe extern "C" fn(msg: *const c_void, context: *mut c_void);
Expand description

phase-417 W5.a — a subscription callback that receives the DESERIALISED message rather than its CDR bytes.

msg is the caller-owned storage handed to the registration, populated by the RawMessageDeserializeFn for this subscription. It is valid for the duration of the call and is overwritten by the next dispatch; anything the callback retains must be copied out.

The context parameter is what makes this the analog of rclc’s rclc_subscription_callback_with_context_t rather than its context-free rclc_subscription_raw_callback_t — C has no closures, and every other callback in this API already carries one, so dropping it would have been the odd shape rather than the faithful one.

§Safety

msg points to the caller’s storage, valid during the call only.