spring_ai_rs/ai_interface/callback/
facing.rs

1use serde::{Deserialize, Serialize};
2use spring_ai_sys::UNIT_COMMAND_BUILD_NO_FACING;
3
4#[derive(Debug, Copy, PartialEq, Eq, Hash, Clone, Serialize, Deserialize)]
5pub enum Facing {
6    North,
7    South,
8    East,
9    West,
10    None,
11}
12
13impl Into<i32> for Facing {
14    fn into(self) -> i32 {
15        match self {
16            Facing::North => 2,
17            Facing::South => 0,
18            Facing::East => 1,
19            Facing::West => 3,
20            Facing::None => UNIT_COMMAND_BUILD_NO_FACING,
21        }
22    }
23}
24
25impl Into<Facing> for i32 {
26    fn into(self) -> Facing {
27        match self {
28            2 => Facing::North,
29            0 => Facing::South,
30            1 => Facing::East,
31            3 => Facing::West,
32            UNIT_COMMAND_BUILD_NO_FACING => Facing::None,
33            _ => unimplemented!(),
34        }
35    }
36}