Skip to main content

ActionServer

Trait ActionServer 

Source
pub trait ActionServer<G, F, R>
where G: Send + 'static, F: Send + 'static, R: Send + 'static,
{ // 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§

Source

fn action_name(&self) -> &str

Source

fn schema(&self) -> &ActionSchema

Source

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.

Source

fn accept_goal(&mut self, goal_id: ActionGoalId) -> Result<(), RtError>

Accept a goal; sends GoalAck { accepted: true } to the client.

Source

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.

Source

fn publish_feedback( &mut self, goal_id: ActionGoalId, feedback: F, ) -> Result<(), RtError>

Push a feedback update to the client (may be called multiple times).

Source

fn heartbeat(&mut self, goal_id: ActionGoalId) -> Result<(), RtError>

Publish a keepalive heartbeat for a running goal.

Source

fn succeed(&mut self, goal_id: ActionGoalId, result: R) -> Result<(), RtError>

Mark the goal as succeeded and deliver the final result.

Source

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.

Source

fn poll_cancel_request(&mut self) -> Option<ActionGoalId>

Poll for a pending cancel request from the client.

Source

fn confirm_cancel(&mut self, goal_id: ActionGoalId) -> Result<(), RtError>

Confirm that cancellation is complete; delivers a GoalStatus::Canceled result.

Source

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.

Implementors§

Source§

impl<G, F, R> ActionServer<G, F, R> for BasicActionServer<G, F, R>
where G: Send + 'static, F: Send + 'static, R: Send + 'static,