Skip to content

Commit d8a0a1d

Browse files
committed
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.
1 parent 4ff9fd4 commit d8a0a1d

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

rosidl_generator_rs/resource/action.rs.em

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,11 @@ impl rosidl_runtime_rs::ActionImpl for @(type_name) {
119119
request.goal_id.uuid
120120
}
121121

122-
fn set_result_response_status(response: &mut <<Self::GetResultService as rosidl_runtime_rs::Service>::Response as rosidl_runtime_rs::Message>::RmwMsg, status: i8) {
123-
response.status = status;
122+
fn create_result_response(status: i8, result: <<Self as Action>::Result as Message>::RmwMsg) -> <<Self::GetResultService as Service>::Response as Message>::RmwMsg {
123+
<<Self::GetResultService as rosidl_runtime_rs::Service>::Response as rosidl_runtime_rs::Message>::RmwMsg {
124+
status,
125+
result,
126+
}
124127
}
125128
}
126129

rosidl_runtime_rs/src/traits.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,6 @@ pub trait ActionImpl: 'static + Action {
208208
/// Get the UUID of a result request.
209209
fn get_result_request_uuid(request: &<<Self::GetResultService as Service>::Request as Message>::RmwMsg) -> [u8; 16];
210210

211-
/// Sets the `status` field of a result response.
212-
fn set_result_response_status(response: &mut <<Self::GetResultService as Service>::Response as Message>::RmwMsg, status: i8);
211+
/// Create a result response message with the given status and contents.
212+
fn create_result_response(status: i8, result: <<Self as Action>::Result as Message>::RmwMsg) -> <<Self::GetResultService as Service>::Response as Message>::RmwMsg;
213213
}

0 commit comments

Comments
 (0)