i made it compile #1

Manually merged
cadey merged 2 commits from artemis/pneuma:master into master 2019-12-18 12:23:36 +00:00
1 changed files with 12 additions and 7 deletions
Showing only changes of commit 2af22fc7d2 - Show all commits

View File

@ -72,7 +72,10 @@ fn find_path(
} }
#[post("/move", format = "json", data = "<msg>")] #[post("/move", format = "json", data = "<msg>")]
fn make_move(cache_state: State<Cache>, msg: Json<battlesnake::SnakeRequest>) -> Json<battlesnake::MoveResponse> { fn make_move(
cache_state: State<Cache>,
msg: Json<battlesnake::SnakeRequest>,
) -> Json<battlesnake::MoveResponse> {
let head = msg.you.body[0]; let head = msg.you.body[0];
let mut cache = cache_state.lock().expect("wanted cache to be unlockable"); let mut cache = cache_state.lock().expect("wanted cache to be unlockable");
@ -88,12 +91,14 @@ fn make_move(cache_state: State<Cache>, msg: Json<battlesnake::SnakeRequest>) ->
Json(battlesnake::MoveResponse { Json(battlesnake::MoveResponse {
move_field: "up".to_string(), move_field: "up".to_string(),
}) })
}, }
Some(next) => Json(battlesnake::MoveResponse { Some(next) => Json(battlesnake::MoveResponse {
move_field: battlesnake::Line { move_field: battlesnake::Line {
start: &head, start: &head,
end: &next, end: &next,
}.direction().to_string(), }
.direction()
.to_string(),
}), }),
} }
} }