Skip to content

Commit dad5a51

Browse files
nwnestevemxgrey
authored
Action message support (#417)
* Added action template * Added action generation * Added basic create_action_client function * dded action generation * checkin * Fix missing exported pre_field_serde field * Removed extra code * Sketch out action server construction and destruction This follows generally the same pattern as the service server. It required adding a typesupport function to the Action trait and pulling in some more rcl_action bindings. * Fix action typesupport function * Add ActionImpl trait with internal messages and services This is incomplete, since the service types aren't yet being generated. * Split srv.rs.em into idiomatic and rmw template files This results in the exact same file being produced for services, except for some whitespace changes. However, it enables actions to invoke the respective service template for its generation, similar to how the it works for services and their underlying messages. * Generate underlying service definitions for actions Not tested * Add runtime trait to get the UUID from a goal request C++ uses duck typing for this, knowing that for any `Action`, the type `Action::Impl::SendGoalService::Request` will always have a `goal_id` field of type `unique_identifier_msgs::msg::UUID` without having to prove this to the compiler. Rust's generics are more strict, requiring that this be proven using type bounds. The `Request` type is also action-specific as it contains a `goal` field containing the `Goal` message type of the action. We therefore cannot enforce that all `Request`s are a specific type in `rclrs`. This seems most easily represented using associated type bounds on the `SendGoalService` associated type within `ActionImpl`. To avoid introducing to `rosidl_runtime_rs` a circular dependency on message packages like `unique_identifier_msgs`, the `ExtractUuid` trait only operates on a byte array rather than a more nicely typed `UUID` message type. I'll likely revisit this as we introduce more similar bounds on the generated types. * Integrate RMW message methods into ActionImpl Rather than having a bunch of standalone traits implementing various message functions like `ExtractUuid` and `SetAccepted`, with the trait bounds on each associated type in `ActionImpl`, we'll instead add these functions directly to the `ActionImpl` trait. This is simpler on both the rosidl_runtime_rs and the rclrs side. * Add rosidl_runtime_rs::ActionImpl::create_feedback_message() Adds a trait method to create a feedback message given the goal ID and the user-facing feedback message type. Depending on how many times we do this, it may end up valuable to define a GoalUuid type in rosidl_runtime_rs itself. We wouldn't be able to utilize the `RCL_ACTION_UUID_SIZE` constant imported from `rcl_action`, but this is pretty much guaranteed to be 16 forever. Defining this method signature also required inverting the super-trait relationship between Action and ActionImpl. Now ActionImpl is the sub-trait as this gives it access to all of Action's associated types. Action doesn't need to care about anything from ActionImpl (hopefully). * Add GetResultService methods to ActionImpl * Implement ActionImpl trait methods in generator These still don't build without errors, but it's close. * Replace set_result_response_status with create_result_response rclrs needs to be able to generically construct result responses, including the user-defined result field. * Implement client-side trait methods for action messages This adds methods to ActionImpl for creating and accessing action-specific message types. These are needed by the rclrs ActionClient to generically read and write RMW messages. Due to issues with qualified paths in certain places (rust-lang/rust#86935), the generator now refers directly to its service and message types rather than going through associated types of the various traits. This also makes the generated code a little easier to read, with the trait method signatures from rosidl_runtime_rs still enforcing type-safety. * Format the rosidl_runtime_rs::ActionImpl trait * Wrap longs lines in rosidl_generator_rs action.rs This at least makes the template easier to read, but also helps with the generated code. In general, the generated code could actually fit on one line for the function signatures, but it's not a big deal to split it across multiple. * Use idiomatic message types in Action trait This is user-facing and so should use the friendly message types. * Cleanup ActionImpl using type aliases Signed-off-by: Michael X. Grey <[email protected]> * Formatting * Switch from std::os::raw::c_void to std::ffi::c_void While these are aliases of each other, we might as well use the more appropriate std::ffi version, as requested by reviewers. * Clean up rosidl_generator_rs's cmake files Some of the variables are present but no longer used. Others were not updated with the action changes. * Add a short doc page on the message generation pipeline This should help newcomers orient themselves around the rosidl_*_rs packages. --------- Signed-off-by: Michael X. Grey <[email protected]> Co-authored-by: Esteve Fernandez <[email protected]> Co-authored-by: Michael X. Grey <[email protected]>
1 parent 06ee9bf commit dad5a51

File tree

12 files changed

+495
-82
lines changed

12 files changed

+495
-82
lines changed

docs/message-generation.md

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# `ros2_rust` Message Generation
2+
3+
The `ros2_rust` project strives to maintain consistency with the upstream ROS 2 message generation
4+
system. To this end, it provides two main packages: `rosidl_generator_rs` and `rosidl_runtime_rs`.
5+
These packages provide the infrastructure required for defining and using ROS 2 messages, services,
6+
and actions in Rust.
7+
8+
At a high level, the `rosidl_generator_rs` package handles generation of interface crates from the
9+
`.msg`, `.srv`, and `.action` files defined by a user. The `rosidl_runtime_rs` package provides
10+
common functionality shared across message packages, such as support types and traits. Each of these
11+
packages is described in more detail below.
12+
13+
## `rosidl_generator_rs`
14+
15+
`rosidl_generator_rs` follows a very similar pattern to the other message generation packages for
16+
ROS 2. To tie into this pipeline, it registers itself as a `"rosidl_generate_idl_interfaces"`
17+
extension with `ament`. Doing so ensures that message packages calling `rosidl_generate_interfaces`
18+
will invoke the Rust language generator in addition to any others. This is accomplished using the
19+
various CMake scripts under the `cmake` directory. When this happens, the input interface files will
20+
be converted into IDL files which, along with additional metadata, are fed into the `generate_rs`
21+
function of `rosidl_generator_rs/__init__.py`.
22+
23+
From here, the IDL files are parsed into an internal representation using the upstream
24+
[`rosidl_parser`](https://github.com/ros2/rosidl/tree/rolling/rosidl_parser) package. This abstract
25+
representation is then used to instantiate the various template files under the `resource`
26+
subdirectory, producing a full Rust crate for each package.
27+
28+
For each input message type, two `struct`s are generated:
29+
30+
- An ergonomic representation of the message, using more idiomatic `std` types like `Vec` and
31+
`String` for sequence and string fields. These are placed directly in the `msg` submodule of the
32+
crate.
33+
- A FFI-suitable `struct` that is ABI-compatible with the layout expected by the RMW layer. While
34+
less ergonomic, these avoid the conversion overhead when passed to RMW. These `struct`s are placed
35+
under the `msg::rmw` submodule.
36+
37+
All the produced `struct`s implement the standard traits from `std` when possible, such as `Clone`,
38+
`PartialEq`, and `Debug`. Additionally, when the generated crate's `serde` feature is enabled, these
39+
structs implement the `Serialize` and `Deserialize` traits.
40+
41+
## `rosidl_runtime_rs`
42+
43+
`rosidl_runtime_rs` is a runtime support package, providing `Message`, `Service`, and `Action`
44+
traits that are implemented by the corresponding structs generated by `rosidl_generator_rs`. These
45+
allow for generic interaction with these various interface types, both in client libraries like
46+
`rclrs` and in user code.
47+
48+
The package also provides a number of string and sequence types that are ABI-compatible with their
49+
`rosidl_runtime_c` equivalents. This allows for more ergonomic use of the RMW-native message types.

rosidl_generator_rs/cmake/custom_command.cmake

+2-6
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,10 @@
1414

1515
add_custom_command(
1616
OUTPUT
17-
${_generated_extension_files}
1817
${_generated_common_rs_files}
1918
${_generated_msg_rs_files}
20-
${_generated_msg_c_files}
2119
${_generated_srv_rs_files}
22-
${_generated_srv_c_files}
20+
${_generated_action_rs_files}
2321
COMMAND ${PYTHON_EXECUTABLE} ${rosidl_generator_rs_BIN}
2422
--generator-arguments-file "${generator_arguments_file}"
2523
--typesupport-impls "${_typesupport_impls}"
@@ -34,11 +32,9 @@ else()
3432
add_custom_target(
3533
${rosidl_generate_interfaces_TARGET}${_target_suffix} ALL
3634
DEPENDS
37-
${_generated_extension_files}
3835
${_generated_common_rs_files}
3936
${_generated_msg_rs_files}
40-
${_generated_msg_c_files}
4137
${_generated_srv_rs_files}
42-
${_generated_srv_c_files}
38+
${_generated_action_rs_files}
4339
)
4440
endif()

rosidl_generator_rs/cmake/rosidl_generator_rs_generate_interfaces.cmake

+19-6
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,11 @@ set(_generated_common_rs_files "")
2626

2727
set(_generated_msg_rs_files "")
2828
set(_generated_srv_rs_files "")
29+
set(_generated_action_rs_files "")
2930

3031
set(_has_msg FALSE)
3132
set(_has_srv FALSE)
33+
set(_has_action FALSE)
3234

3335
foreach(_idl_file ${rosidl_generate_interfaces_ABS_IDL_FILES})
3436
get_filename_component(_parent_folder "${_idl_file}" DIRECTORY)
@@ -37,13 +39,13 @@ foreach(_idl_file ${rosidl_generate_interfaces_ABS_IDL_FILES})
3739

3840
if(_parent_folder STREQUAL "msg")
3941
set(_has_msg TRUE)
40-
set(_idl_file_without_actions ${_idl_file_without_actions} ${_idl_file})
42+
set(_idl_files ${_idl_files} ${_idl_file})
4143
elseif(_parent_folder STREQUAL "srv")
4244
set(_has_srv TRUE)
43-
set(_idl_file_without_actions ${_idl_file_without_actions} ${_idl_file})
45+
set(_idl_files ${_idl_files} ${_idl_file})
4446
elseif(_parent_folder STREQUAL "action")
4547
set(_has_action TRUE)
46-
message(WARNING "Rust actions generation is not implemented")
48+
set(_idl_files ${_idl_files} ${_idl_file})
4749
else()
4850
message(FATAL_ERROR "Interface file with unknown parent folder: ${_idl_file}")
4951
endif()
@@ -67,6 +69,12 @@ if(${_has_srv})
6769
)
6870
endif()
6971

72+
if(${_has_action})
73+
list(APPEND _generated_action_rs_files
74+
"${_output_path}/rust/src/action.rs"
75+
)
76+
endif()
77+
7078
set(_dependency_files "")
7179
set(_dependencies "")
7280
foreach(_pkg_name ${rosidl_generate_interfaces_DEPENDENCY_PACKAGE_NAMES})
@@ -81,12 +89,15 @@ endforeach()
8189
set(target_dependencies
8290
"${rosidl_generator_rs_BIN}"
8391
${rosidl_generator_rs_GENERATOR_FILES}
92+
"${rosidl_generator_rs_TEMPLATE_DIR}/action.rs.em"
8493
"${rosidl_generator_rs_TEMPLATE_DIR}/msg_idiomatic.rs.em"
8594
"${rosidl_generator_rs_TEMPLATE_DIR}/msg_rmw.rs.em"
8695
"${rosidl_generator_rs_TEMPLATE_DIR}/msg.rs.em"
96+
"${rosidl_generator_rs_TEMPLATE_DIR}/srv_idiomatic.rs.em"
97+
"${rosidl_generator_rs_TEMPLATE_DIR}/srv_rmw.rs.em"
8798
"${rosidl_generator_rs_TEMPLATE_DIR}/srv.rs.em"
8899
${rosidl_generate_interfaces_ABS_IDL_FILES}
89-
${_idl_file_without_actions}
100+
${_idl_files}
90101
${_dependency_files})
91102
foreach(dep ${target_dependencies})
92103
if(NOT EXISTS "${dep}")
@@ -99,7 +110,7 @@ rosidl_write_generator_arguments(
99110
"${generator_arguments_file}"
100111
PACKAGE_NAME "${PROJECT_NAME}"
101112
IDL_TUPLES "${rosidl_generate_interfaces_IDL_TUPLES}"
102-
ROS_INTERFACE_FILES "${_idl_file_without_actions}"
113+
ROS_INTERFACE_FILES "${_idl_files}"
103114
ROS_INTERFACE_DEPENDENCIES "${_dependencies}"
104115
OUTPUT_DIR "${_output_path}"
105116
TEMPLATE_DIR "${rosidl_generator_rs_TEMPLATE_DIR}"
@@ -130,6 +141,7 @@ set_property(
130141
${_generated_common_rs_files}
131142
${_generated_msg_rs_files}
132143
${_generated_srv_rs_files}
144+
${_generated_action_rs_files}
133145
PROPERTY GENERATED 1)
134146

135147
set(_rsext_suffix "__rsext")
@@ -144,7 +156,8 @@ endif()
144156
if(BUILD_TESTING AND rosidl_generate_interfaces_ADD_LINTER_TESTS)
145157
if(
146158
NOT _generated_msg_rs_files STREQUAL "" OR
147-
NOT _generated_srv_rs_files STREQUAL ""
159+
NOT _generated_srv_rs_files STREQUAL "" OR
160+
NOT _generated_action_rs_files STREQUAL ""
148161
)
149162
# TODO(esteve): add linters for Rust files
150163
endif()
+205
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,205 @@
1+
@{
2+
from rosidl_parser.definition import (
3+
ACTION_FEEDBACK_MESSAGE_SUFFIX,
4+
ACTION_FEEDBACK_SUFFIX,
5+
ACTION_GOAL_SERVICE_SUFFIX,
6+
ACTION_GOAL_SUFFIX,
7+
ACTION_RESULT_SERVICE_SUFFIX,
8+
ACTION_RESULT_SUFFIX,
9+
SERVICE_REQUEST_MESSAGE_SUFFIX,
10+
SERVICE_RESPONSE_MESSAGE_SUFFIX,
11+
)
12+
13+
action_msg_specs = []
14+
15+
for subfolder, action in action_specs:
16+
action_msg_specs.append((subfolder, action.goal))
17+
action_msg_specs.append((subfolder, action.result))
18+
action_msg_specs.append((subfolder, action.feedback))
19+
action_msg_specs.append((subfolder, action.feedback_message))
20+
21+
action_srv_specs = []
22+
23+
for subfolder, action in action_specs:
24+
action_srv_specs.append((subfolder, action.send_goal_service))
25+
action_srv_specs.append((subfolder, action.get_result_service))
26+
}@
27+
28+
pub mod rmw {
29+
@{
30+
TEMPLATE(
31+
'msg_rmw.rs.em',
32+
package_name=package_name, interface_path=interface_path,
33+
msg_specs=action_msg_specs,
34+
get_rs_name=get_rs_name, get_rmw_rs_type=get_rmw_rs_type,
35+
pre_field_serde=pre_field_serde,
36+
get_idiomatic_rs_type=get_idiomatic_rs_type,
37+
constant_value_to_rs=constant_value_to_rs)
38+
39+
TEMPLATE(
40+
'srv_rmw.rs.em',
41+
package_name=package_name, interface_path=interface_path,
42+
srv_specs=action_srv_specs,
43+
get_rs_name=get_rs_name, get_rmw_rs_type=get_rmw_rs_type,
44+
pre_field_serde=pre_field_serde,
45+
get_idiomatic_rs_type=get_idiomatic_rs_type,
46+
constant_value_to_rs=constant_value_to_rs)
47+
}@
48+
} // mod rmw
49+
50+
@{
51+
TEMPLATE(
52+
'msg_idiomatic.rs.em',
53+
package_name=package_name, interface_path=interface_path,
54+
msg_specs=action_msg_specs,
55+
get_rs_name=get_rs_name, get_rmw_rs_type=get_rmw_rs_type,
56+
pre_field_serde=pre_field_serde,
57+
get_idiomatic_rs_type=get_idiomatic_rs_type,
58+
constant_value_to_rs=constant_value_to_rs)
59+
}@
60+
61+
@{
62+
TEMPLATE(
63+
'srv_idiomatic.rs.em',
64+
package_name=package_name, interface_path=interface_path,
65+
srv_specs=action_srv_specs,
66+
get_rs_name=get_rs_name, get_rmw_rs_type=get_rmw_rs_type,
67+
pre_field_serde=pre_field_serde,
68+
get_idiomatic_rs_type=get_idiomatic_rs_type,
69+
constant_value_to_rs=constant_value_to_rs)
70+
}@
71+
72+
@[for subfolder, action_spec in action_specs]
73+
74+
@{
75+
type_name = action_spec.namespaced_type.name
76+
}@
77+
78+
#[link(name = "@(package_name)__rosidl_typesupport_c")]
79+
extern "C" {
80+
fn rosidl_typesupport_c__get_action_type_support_handle__@(package_name)__@(subfolder)__@(type_name)() -> *const std::ffi::c_void;
81+
}
82+
83+
// Corresponds to @(package_name)__@(subfolder)__@(type_name)
84+
pub struct @(type_name);
85+
86+
impl rosidl_runtime_rs::Action for @(type_name) {
87+
type Goal = crate::@(subfolder)::@(type_name)@(ACTION_GOAL_SUFFIX);
88+
type Result = crate::@(subfolder)::@(type_name)@(ACTION_RESULT_SUFFIX);
89+
type Feedback = crate::@(subfolder)::@(type_name)@(ACTION_FEEDBACK_SUFFIX);
90+
91+
fn get_type_support() -> *const std::ffi::c_void {
92+
// SAFETY: No preconditions for this function.
93+
unsafe { rosidl_typesupport_c__get_action_type_support_handle__@(package_name)__@(subfolder)__@(type_name)() }
94+
}
95+
}
96+
97+
impl rosidl_runtime_rs::ActionImpl for @(type_name) {
98+
type GoalStatusMessage = action_msgs::msg::rmw::GoalStatusArray;
99+
type FeedbackMessage = crate::@(subfolder)::rmw::@(type_name)@(ACTION_FEEDBACK_MESSAGE_SUFFIX);
100+
101+
type SendGoalService = crate::@(subfolder)::rmw::@(type_name)@(ACTION_GOAL_SERVICE_SUFFIX);
102+
type CancelGoalService = action_msgs::srv::rmw::CancelGoal;
103+
type GetResultService = crate::@(subfolder)::rmw::@(type_name)@(ACTION_RESULT_SERVICE_SUFFIX);
104+
105+
fn create_goal_request(
106+
goal_id: &[u8; 16],
107+
goal: crate::@(subfolder)::rmw::@(type_name)@(ACTION_GOAL_SUFFIX),
108+
) -> crate::@(subfolder)::rmw::@(type_name)@(ACTION_GOAL_SERVICE_SUFFIX)@(SERVICE_REQUEST_MESSAGE_SUFFIX) {
109+
crate::@(subfolder)::rmw::@(type_name)@(ACTION_GOAL_SERVICE_SUFFIX)@(SERVICE_REQUEST_MESSAGE_SUFFIX) {
110+
goal_id: unique_identifier_msgs::msg::rmw::UUID { uuid: *goal_id },
111+
goal,
112+
}
113+
}
114+
115+
fn get_goal_request_uuid(
116+
request: &crate::@(subfolder)::rmw::@(type_name)@(ACTION_GOAL_SERVICE_SUFFIX)@(SERVICE_REQUEST_MESSAGE_SUFFIX),
117+
) -> &[u8; 16] {
118+
&request.goal_id.uuid
119+
}
120+
121+
fn create_goal_response(
122+
accepted: bool,
123+
stamp: (i32, u32),
124+
) -> crate::@(subfolder)::rmw::@(type_name)@(ACTION_GOAL_SERVICE_SUFFIX)@(SERVICE_RESPONSE_MESSAGE_SUFFIX) {
125+
crate::@(subfolder)::rmw::@(type_name)@(ACTION_GOAL_SERVICE_SUFFIX)@(SERVICE_RESPONSE_MESSAGE_SUFFIX) {
126+
accepted,
127+
stamp: builtin_interfaces::msg::rmw::Time {
128+
sec: stamp.0,
129+
nanosec: stamp.1,
130+
},
131+
}
132+
}
133+
134+
fn get_goal_response_accepted(
135+
response: &crate::@(subfolder)::rmw::@(type_name)@(ACTION_GOAL_SERVICE_SUFFIX)@(SERVICE_RESPONSE_MESSAGE_SUFFIX),
136+
) -> bool {
137+
response.accepted
138+
}
139+
140+
fn get_goal_response_stamp(
141+
response: &crate::@(subfolder)::rmw::@(type_name)@(ACTION_GOAL_SERVICE_SUFFIX)@(SERVICE_RESPONSE_MESSAGE_SUFFIX),
142+
) -> (i32, u32) {
143+
(response.stamp.sec, response.stamp.nanosec)
144+
}
145+
146+
fn create_feedback_message(
147+
goal_id: &[u8; 16],
148+
feedback: crate::@(subfolder)::rmw::@(type_name)@(ACTION_FEEDBACK_SUFFIX),
149+
) -> crate::@(subfolder)::rmw::@(type_name)@(ACTION_FEEDBACK_MESSAGE_SUFFIX) {
150+
let mut message = crate::@(subfolder)::rmw::@(type_name)@(ACTION_FEEDBACK_MESSAGE_SUFFIX)::default();
151+
message.goal_id.uuid = *goal_id;
152+
message.feedback = feedback;
153+
message
154+
}
155+
156+
fn get_feedback_message_uuid(
157+
feedback: &crate::@(subfolder)::rmw::@(type_name)@(ACTION_FEEDBACK_MESSAGE_SUFFIX),
158+
) -> &[u8; 16] {
159+
&feedback.goal_id.uuid
160+
}
161+
162+
fn get_feedback_message_feedback(
163+
feedback: &crate::@(subfolder)::rmw::@(type_name)@(ACTION_FEEDBACK_MESSAGE_SUFFIX),
164+
) -> &crate::@(subfolder)::rmw::@(type_name)@(ACTION_FEEDBACK_SUFFIX) {
165+
&feedback.feedback
166+
}
167+
168+
fn create_result_request(
169+
goal_id: &[u8; 16],
170+
) -> crate::@(subfolder)::rmw::@(type_name)@(ACTION_RESULT_SERVICE_SUFFIX)@(SERVICE_REQUEST_MESSAGE_SUFFIX) {
171+
crate::@(subfolder)::rmw::@(type_name)@(ACTION_RESULT_SERVICE_SUFFIX)@(SERVICE_REQUEST_MESSAGE_SUFFIX) {
172+
goal_id: unique_identifier_msgs::msg::rmw::UUID { uuid: *goal_id },
173+
}
174+
}
175+
176+
fn get_result_request_uuid(
177+
request: &crate::@(subfolder)::rmw::@(type_name)@(ACTION_RESULT_SERVICE_SUFFIX)@(SERVICE_REQUEST_MESSAGE_SUFFIX),
178+
) -> &[u8; 16] {
179+
&request.goal_id.uuid
180+
}
181+
182+
fn create_result_response(
183+
status: i8,
184+
result: crate::@(subfolder)::rmw::@(type_name)@(ACTION_RESULT_SUFFIX),
185+
) -> crate::@(subfolder)::rmw::@(type_name)@(ACTION_RESULT_SERVICE_SUFFIX)@(SERVICE_RESPONSE_MESSAGE_SUFFIX) {
186+
crate::@(subfolder)::rmw::@(type_name)@(ACTION_RESULT_SERVICE_SUFFIX)@(SERVICE_RESPONSE_MESSAGE_SUFFIX) {
187+
status,
188+
result,
189+
}
190+
}
191+
192+
fn get_result_response_result(
193+
response: &crate::@(subfolder)::rmw::@(type_name)@(ACTION_RESULT_SERVICE_SUFFIX)@(SERVICE_RESPONSE_MESSAGE_SUFFIX),
194+
) -> &crate::@(subfolder)::rmw::@(type_name)@(ACTION_RESULT_SUFFIX) {
195+
&response.result
196+
}
197+
198+
fn get_result_response_status(
199+
response: &crate::@(subfolder)::rmw::@(type_name)@(ACTION_RESULT_SERVICE_SUFFIX)@(SERVICE_RESPONSE_MESSAGE_SUFFIX),
200+
) -> i8 {
201+
response.status
202+
}
203+
}
204+
205+
@[end for]

rosidl_generator_rs/resource/lib.rs.em

+4
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,7 @@ pub mod msg;
77
@[if len(srv_specs) > 0]@
88
pub mod srv;
99
@[end if]@
10+
11+
@[if len(action_specs) > 0]@
12+
pub mod action;
13+
@[end if]@

rosidl_generator_rs/resource/msg_rmw.rs.em

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ type_name = msg_spec.structure.namespaced_type.name
1919

2020
#[link(name = "@(package_name)__rosidl_typesupport_c")]
2121
extern "C" {
22-
fn rosidl_typesupport_c__get_message_type_support_handle__@(package_name)__@(subfolder)__@(type_name)() -> *const std::os::raw::c_void;
22+
fn rosidl_typesupport_c__get_message_type_support_handle__@(package_name)__@(subfolder)__@(type_name)() -> *const std::ffi::c_void;
2323
}
2424

2525
#[link(name = "@(package_name)__rosidl_generator_c")]
@@ -103,7 +103,7 @@ impl rosidl_runtime_rs::Message for @(type_name) {
103103
104104
impl rosidl_runtime_rs::RmwMessage for @(type_name) where Self: Sized {
105105
const TYPE_NAME: &'static str = "@(package_name)/@(subfolder)/@(type_name)";
106-
fn get_type_support() -> *const std::os::raw::c_void {
106+
fn get_type_support() -> *const std::ffi::c_void {
107107
// SAFETY: No preconditions for this function.
108108
unsafe { rosidl_typesupport_c__get_message_type_support_handle__@(package_name)__@(subfolder)__@(type_name)() }
109109
}

0 commit comments

Comments
 (0)