Trait oc2_hlapi::device::RobotInterface
source · pub trait RobotInterface: RpcDevice {
// Required methods
fn get_energy_stored(&self) -> Result<i32>
where i32: DeserializeOwned + 'static;
fn get_energy_capacity(&self) -> Result<i32>
where i32: DeserializeOwned + 'static;
fn get_selected_slot(&self) -> Result<i32>
where i32: DeserializeOwned + 'static;
fn set_selected_slot(&self, slot: i32) -> Result<()>
where (): DeserializeOwned + 'static;
fn get_stack_in_slot<T>(&self, slot: i32) -> Result<T>
where T: DeserializeOwned + 'static;
fn queue_move(&self, direction: Direction) -> Result<bool>
where bool: DeserializeOwned + 'static;
fn queue_turn(&self, direction: RotationDirection) -> Result<bool>
where bool: DeserializeOwned + 'static;
fn get_last_action_id(&self) -> Result<i32>
where i32: DeserializeOwned + 'static;
fn get_queued_action_count(&self) -> Result<i32>
where i32: DeserializeOwned + 'static;
fn get_action_result(&self, id: i32) -> Result<RobotActionResult>
where RobotActionResult: DeserializeOwned + 'static;
}Expand description
An interface between robots and the HLAPI.
Required Methods§
sourcefn get_energy_stored(&self) -> Result<i32>where
i32: DeserializeOwned + 'static,
fn get_energy_stored(&self) -> Result<i32>where
i32: DeserializeOwned + 'static,
Returns the amount of FE stored in a robot.
sourcefn get_energy_capacity(&self) -> Result<i32>where
i32: DeserializeOwned + 'static,
fn get_energy_capacity(&self) -> Result<i32>where
i32: DeserializeOwned + 'static,
Returns the maximum possible energy that a robot can store.
sourcefn get_selected_slot(&self) -> Result<i32>where
i32: DeserializeOwned + 'static,
fn get_selected_slot(&self) -> Result<i32>where
i32: DeserializeOwned + 'static,
Returns the index of the currently active slot.
sourcefn set_selected_slot(&self, slot: i32) -> Result<()>where
(): DeserializeOwned + 'static,
fn set_selected_slot(&self, slot: i32) -> Result<()>where
(): DeserializeOwned + 'static,
Sets the currently active slot to the given index.
sourcefn get_stack_in_slot<T>(&self, slot: i32) -> Result<T>where
T: DeserializeOwned + 'static,
fn get_stack_in_slot<T>(&self, slot: i32) -> Result<T>where
T: DeserializeOwned + 'static,
Returns information about the item in the given slot.
sourcefn queue_move(&self, direction: Direction) -> Result<bool>where
bool: DeserializeOwned + 'static,
fn queue_move(&self, direction: Direction) -> Result<bool>where
bool: DeserializeOwned + 'static,
Attempts to queue an action which moves the robot in the given direction. Returns true if the action was successfully queued.
sourcefn queue_turn(&self, direction: RotationDirection) -> Result<bool>where
bool: DeserializeOwned + 'static,
fn queue_turn(&self, direction: RotationDirection) -> Result<bool>where
bool: DeserializeOwned + 'static,
Attempts to queue an action which turns the robot in the given direction. Returns true if the action was successfully queued.
sourcefn get_last_action_id(&self) -> Result<i32>where
i32: DeserializeOwned + 'static,
fn get_last_action_id(&self) -> Result<i32>where
i32: DeserializeOwned + 'static,
Returns the ID of the previously performed action.
sourcefn get_queued_action_count(&self) -> Result<i32>where
i32: DeserializeOwned + 'static,
fn get_queued_action_count(&self) -> Result<i32>where
i32: DeserializeOwned + 'static,
Returns the currently queued number of actions.
sourcefn get_action_result(&self, id: i32) -> Result<RobotActionResult>where
RobotActionResult: DeserializeOwned + 'static,
fn get_action_result(&self, id: i32) -> Result<RobotActionResult>where
RobotActionResult: DeserializeOwned + 'static,
Returns the state of a robot’s action with a given ID.
Object Safety§
This trait is not object safe.