pub trait ActionServer<G, F, R>{
// Required methods
fn action_name(&self) -> &str;
fn schema(&self) -> &ActionSchema;
fn recv_goal(&mut self) -> Result<Option<(ActionGoalId, G)>, RtError>;
fn accept_goal(&mut self, goal_id: ActionGoalId) -> Result<(), RtError>;
fn reject_goal(
&mut self,
goal_id: ActionGoalId,
reason: impl Into<String>,
) -> Result<(), RtError>;
fn publish_feedback(
&mut self,
goal_id: ActionGoalId,
feedback: F,
) -> Result<(), RtError>;
fn heartbeat(&mut self, goal_id: ActionGoalId) -> Result<(), RtError>;
fn succeed(
&mut self,
goal_id: ActionGoalId,
result: R,
) -> Result<(), RtError>;
fn fail(
&mut self,
goal_id: ActionGoalId,
reason: impl Into<String>,
) -> Result<(), RtError>;
fn poll_cancel_request(&mut self) -> Option<ActionGoalId>;
fn confirm_cancel(&mut self, goal_id: ActionGoalId) -> Result<(), RtError>;
fn close(&mut self) -> Result<(), RtError>;
}Expand description
Server-side handle: receives goals, publishes feedback, and sends the final result.
Required Methods§
fn action_name(&self) -> &str
fn schema(&self) -> &ActionSchema
Sourcefn recv_goal(&mut self) -> Result<Option<(ActionGoalId, G)>, RtError>
fn recv_goal(&mut self) -> Result<Option<(ActionGoalId, G)>, RtError>
Receive the next pending goal (FIFO).
After returning Some, the server must call either accept_goal or
reject_goal; otherwise the client will wait indefinitely for a GoalAck.
Sourcefn accept_goal(&mut self, goal_id: ActionGoalId) -> Result<(), RtError>
fn accept_goal(&mut self, goal_id: ActionGoalId) -> Result<(), RtError>
Accept a goal; sends GoalAck { accepted: true } to the client.
Sourcefn reject_goal(
&mut self,
goal_id: ActionGoalId,
reason: impl Into<String>,
) -> Result<(), RtError>
fn reject_goal( &mut self, goal_id: ActionGoalId, reason: impl Into<String>, ) -> Result<(), RtError>
Reject a goal; sends GoalAck { accepted: false, reason } to the client.
Sourcefn publish_feedback(
&mut self,
goal_id: ActionGoalId,
feedback: F,
) -> Result<(), RtError>
fn publish_feedback( &mut self, goal_id: ActionGoalId, feedback: F, ) -> Result<(), RtError>
Push a feedback update to the client (may be called multiple times).
Sourcefn heartbeat(&mut self, goal_id: ActionGoalId) -> Result<(), RtError>
fn heartbeat(&mut self, goal_id: ActionGoalId) -> Result<(), RtError>
Publish a keepalive heartbeat for a running goal.
Sourcefn succeed(&mut self, goal_id: ActionGoalId, result: R) -> Result<(), RtError>
fn succeed(&mut self, goal_id: ActionGoalId, result: R) -> Result<(), RtError>
Mark the goal as succeeded and deliver the final result.
Sourcefn fail(
&mut self,
goal_id: ActionGoalId,
reason: impl Into<String>,
) -> Result<(), RtError>
fn fail( &mut self, goal_id: ActionGoalId, reason: impl Into<String>, ) -> Result<(), RtError>
Mark the goal as failed and deliver the final result with an error reason.
Sourcefn poll_cancel_request(&mut self) -> Option<ActionGoalId>
fn poll_cancel_request(&mut self) -> Option<ActionGoalId>
Poll for a pending cancel request from the client.
Sourcefn confirm_cancel(&mut self, goal_id: ActionGoalId) -> Result<(), RtError>
fn confirm_cancel(&mut self, goal_id: ActionGoalId) -> Result<(), RtError>
Confirm that cancellation is complete; delivers a GoalStatus::Canceled result.
fn close(&mut self) -> Result<(), RtError>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.