1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
use serde::Deserialize; #[derive(Debug, Deserialize, Eq, PartialEq)] pub struct Location { x: u32, y: u32, } #[derive(Debug, Deserialize, Eq, PartialEq)] pub struct Turn { game: Game, turn: u32, board: Board, you: Snake, } #[derive(Debug, Deserialize, Eq, PartialEq)] pub struct Game { id: String, timeout: u32, } #[derive(Debug, Deserialize, Eq, PartialEq)] pub struct Board { height: u32, width: u32, food: Vec<Location>, hazards: Vec<Location>, snakes: Vec<Snake>, } #[derive(Debug, Deserialize, Eq, PartialEq)] pub struct Snake { id: String, name: String, health: u32, body: Vec<Location>, latency: String, head: Location, length: u32, shout: String, squad: String, }