worked on the api abit, nearly finished with choice implementation
This commit is contained in:
Binary file not shown.
Binary file not shown.
+3
-1
@@ -72,9 +72,11 @@ pub async fn api_process
|
||||
.map(|index: usize, tx_handle: Sender<(bool,usize)>| {
|
||||
debug!("Choice: {}", index);
|
||||
let _ = tx_handle.send((true,index));
|
||||
let reply = "ack";
|
||||
warp::reply::json(&reply)
|
||||
}).boxed();
|
||||
|
||||
let routes = main.or(characters);
|
||||
let routes = main.or(characters).or(choice);
|
||||
// Start the server
|
||||
warp::serve(routes)
|
||||
.run(([127, 0, 0, 1],config::API_PORT))
|
||||
|
||||
+8
-3
@@ -62,11 +62,16 @@ pub async fn token_parse(
|
||||
},
|
||||
"choice" =>
|
||||
{
|
||||
index += match choice_parse(index+1, &tokens, &data_to_send).await
|
||||
let (_,jump_points) = match choice_parse(index+1, &tokens, &data_to_send).await
|
||||
{
|
||||
Ok(increment) => increment,
|
||||
Ok((increment,jump_point)) => (increment,jump_point),
|
||||
Err(error) => return Err(error),
|
||||
}
|
||||
};
|
||||
if rx.recv().is_err() { warn!("Error sending choices to client"); };
|
||||
let (_, choice) = rx.recv().unwrap(); // TODO eh
|
||||
index = jump_points[choice];
|
||||
debug!("{:?} {} {}",jump_points, choice, index);
|
||||
continue
|
||||
}
|
||||
_ =>
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user