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§

source

fn get_energy_stored(&self) -> Result<i32>
where i32: DeserializeOwned + 'static,

Returns the amount of FE stored in a robot.

source

fn get_energy_capacity(&self) -> Result<i32>
where i32: DeserializeOwned + 'static,

Returns the maximum possible energy that a robot can store.

source

fn get_selected_slot(&self) -> Result<i32>
where i32: DeserializeOwned + 'static,

Returns the index of the currently active slot.

source

fn set_selected_slot(&self, slot: i32) -> Result<()>
where (): DeserializeOwned + 'static,

Sets the currently active slot to the given index.

source

fn get_stack_in_slot<T>(&self, slot: i32) -> Result<T>
where T: DeserializeOwned + 'static,

Returns information about the item in the given slot.

source

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.

source

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.

source

fn get_last_action_id(&self) -> Result<i32>
where i32: DeserializeOwned + 'static,

Returns the ID of the previously performed action.

source

fn get_queued_action_count(&self) -> Result<i32>
where i32: DeserializeOwned + 'static,

Returns the currently queued number of actions.

source

fn get_action_result(&self, id: i32) -> Result<RobotActionResult>

Returns the state of a robot’s action with a given ID.

Object Safety§

This trait is not object safe.

Implementors§