diff --git a/src/main.rs b/src/main.rs index 198644f..7518f52 100644 --- a/src/main.rs +++ b/src/main.rs @@ -38,7 +38,7 @@ include!(concat!(env!("OUT_DIR"), "/static.rs")); #[link_args="-ltinfo"] extern { } -type PLIGenerator = Box Box + Send>; +type PLIGenerator = Box Box + Send + Sync>; fn main() { let languages: Vec> = diff --git a/src/webapp.rs b/src/webapp.rs index 5d0023d..11120ed 100644 --- a/src/webapp.rs +++ b/src/webapp.rs @@ -6,7 +6,6 @@ use rocket_contrib::Json; use language::{ProgrammingLanguageInterface, EvalOptions}; use WEBFILES; use ::PLIGenerator; -use std::sync::Mutex; #[get("/")] fn index() -> Content { @@ -33,12 +32,12 @@ struct Output { } #[post("/input", format = "application/json", data = "")] -fn interpreter_input(input: Json, schala_gen: State>) -> Json { - let mut schala: Box = schala_gen.lock().unwrap()(); +fn interpreter_input(input: Json, schala_gen: State) -> Json { + let mut schala: Box = schala_gen(); let code_output = schala.evaluate_in_repl(&input.source, &EvalOptions::default()); Json(Output { text: code_output.to_string() }) } pub fn web_main(language_generators: Vec>, func: PLIGenerator) { - rocket::ignite().manage(Mutex::new(func)).mount("/", routes![index, js_bundle, interpreter_input]).launch(); + rocket::ignite().manage(func).mount("/", routes![index, js_bundle, interpreter_input]).launch(); }