Did a bit of polishing up

This commit is contained in:
2026-04-29 00:40:29 +01:00
parent c53138b163
commit 660f7cad7e
11 changed files with 293 additions and 461 deletions
+14 -10
View File
@@ -1,14 +1,16 @@
use std::
{
fs,
thread,
collections::HashMap,
sync::{Arc, Mutex, mpsc},
};
use serde::{Deserialize, Serialize};
use tokio::runtime::Runtime;
use tokio::task;
use warp::Filter;
use log::
{
info,
trace,
warn,
debug,
};
mod parsing;
mod character;
@@ -16,9 +18,11 @@ mod config;
mod api;
#[tokio::main]
async fn main() {
async fn main()
{
env_logger::init();
let (tx,rx) = mpsc::channel();
let mut data_to_send = Arc::new(Mutex::new(api::Data_to_send
let data_to_send = Arc::new(Mutex::new(api::DataToSend
{
action_type: "initialise".to_string(),
content: "".to_string(),
@@ -32,7 +36,7 @@ async fn main() {
async move {
api::api_process(data, tx_clone).await;
});
println!("and continue");
debug!("and continue");
let mut characters = HashMap::<String, character::Character>::new();
let file_contents: String = fs::read_to_string("stories/story.ha").unwrap();
// Split the file contents into tokens
@@ -43,7 +47,7 @@ async fn main() {
let data_clone = Arc::clone(&data_to_send);
match parsing::token_parse(&tokens, &mut characters, data_clone, &rx).await
{
Ok(()) => println!("Program exited successfully"),
Err(error) => println!("{}", error),
Ok(()) => info!("Program exited successfully"),
Err(error) => eprintln!("{}", error),
}
}