Skip to content

Commit e2e043f

Browse files
committed
Introduce split_ API
Signed-off-by: Michael X. Grey <[email protected]>
1 parent eacc652 commit e2e043f

File tree

1 file changed

+12
-19
lines changed

1 file changed

+12
-19
lines changed

rosidl_runtime_rs/src/traits.rs

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,6 @@ pub trait Action: 'static {
174174
/// The feedback message associated with this action.
175175
type Feedback: Message;
176176

177-
/// The goal_status message associated with this action.
178-
type GoalStatusMessage: Message;
179-
180177
/// The feedback message associated with this action.
181178
type FeedbackMessage: Message;
182179

@@ -195,11 +192,10 @@ pub trait Action: 'static {
195192
/// Create a goal request message with the given UUID and goal.
196193
fn create_goal_request(goal_id: &[u8; 16], goal: RmwGoalData<Self>) -> RmwGoalRequest<Self>;
197194

198-
/// Get the UUID of a send goal request.
199-
fn get_goal_request_uuid(request: &RmwGoalRequest<Self>) -> &[u8; 16];
200-
201-
/// Get the goal data of a send goal request.
202-
fn get_goal_request_data(request: &RmwGoalRequest<Self>) -> &RmwGoalData<Self>;
195+
/// Split a goal request message into its two parts:
196+
/// * The UUID of the goal
197+
/// * The message that describes the goal
198+
fn split_goal_request(request: RmwGoalRequest<Self>) -> ([u8; 16], RmwGoalData<Self>);
203199

204200
/// Create a goal response message with the given acceptance and timestamp.
205201
fn create_goal_response(accepted: bool, stamp: (i32, u32)) -> RmwGoalResponse<Self>;
@@ -216,12 +212,10 @@ pub trait Action: 'static {
216212
feedback: RmwFeedbackData<Self>,
217213
) -> RmwFeedbackMessage<Self>;
218214

219-
/// Get the UUID of a feedback message.
220-
fn get_feedback_message_uuid(feedback: &RmwFeedbackMessage<Self>) -> &[u8; 16];
221-
222-
/// Get the feedback data of a feedback message.
223-
fn get_feedback_message_data(feedback: &RmwFeedbackMessage<Self>)
224-
-> &RmwFeedbackData<Self>;
215+
/// Split a feedback message into its two parts:
216+
/// * The UUID of the goal that the feedback is for
217+
/// * The message the describes the feedback data
218+
fn split_feedback_message(feedback: RmwFeedbackMessage<Self>) -> ([u8; 16], RmwFeedbackData<Self>);
225219

226220
/// Create a result request message with the given goal ID.
227221
fn create_result_request(goal_id: &[u8; 16]) -> RmwResultRequest<Self>;
@@ -232,11 +226,10 @@ pub trait Action: 'static {
232226
/// Create a result response message with the given status and contents.
233227
fn create_result_response(status: i8, result: RmwResultData<Self>) -> RmwResultResponse<Self>;
234228

235-
/// Get the result of a result response.
236-
fn get_result_response_data(response: &RmwResultResponse<Self>) -> &RmwResultData<Self>;
237-
238-
/// Get the status of a result response.
239-
fn get_result_response_status(response: &RmwResultResponse<Self>) -> i8;
229+
/// Split a result response into its two parts:
230+
/// * The status of the result (e.g. Succeeded, Aborted, Cancelled)
231+
/// * The message that describes the final result of the action
232+
fn split_result_response(response: RmwResultResponse<Self>) -> (i8, RmwResultData<Self>);
240233
}
241234

242235
// ---- Type definitions to simplify the Action trait -----

0 commit comments

Comments
 (0)