Implemented choices successfully
This commit is contained in:
+16
-9
@@ -9,9 +9,13 @@ use log::
|
||||
info,
|
||||
warn,
|
||||
debug,
|
||||
error,
|
||||
};
|
||||
use serde::
|
||||
{
|
||||
Deserialize,
|
||||
Serialize
|
||||
};
|
||||
use serde_json::from_str;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
mod parsing;
|
||||
mod character;
|
||||
@@ -34,13 +38,16 @@ async fn main()
|
||||
choices: vec![],
|
||||
}));
|
||||
// Setup the characters hashmap which will store each character in it as a Character struct
|
||||
let mut characters: Arc<Mutex<HashMap::<String, character::Character>>> = Default::default();
|
||||
match character::character_parse().await
|
||||
let characters = match character::character_parse().await
|
||||
{
|
||||
Ok(result) => characters = result, //let mut characters = character,
|
||||
Err(error) =>
|
||||
Ok(result) =>
|
||||
{
|
||||
eprintln!("{}",error);
|
||||
info!("{:?}", result);
|
||||
result
|
||||
},
|
||||
Err(error) =>
|
||||
{
|
||||
error!("{}",error);
|
||||
std::process::exit(3);
|
||||
},
|
||||
};
|
||||
@@ -64,7 +71,7 @@ async fn main()
|
||||
let file_contents: String = fs::read_to_string("stories/story.ha") // TODO make this a command line argument
|
||||
.unwrap_or_else(|err|
|
||||
{
|
||||
eprintln!("Failed to read file: {}", err);
|
||||
error!("Failed to read file: {}", err);
|
||||
std::process::exit(2);
|
||||
});
|
||||
let tokens: Vec<&str> = file_contents
|
||||
@@ -96,7 +103,7 @@ async fn main()
|
||||
},
|
||||
Err(error) =>
|
||||
{
|
||||
eprintln!("{}", error);
|
||||
error!("{}", error);
|
||||
std::process::exit(1);
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user