From 277e039251dcf7eaf1a7d2b6f3fbd3b15e2b8e04 Mon Sep 17 00:00:00 2001 From: greg Date: Sun, 29 Oct 2017 03:41:40 -0700 Subject: [PATCH] Finally removed schala dependency Now need to clena up everything --- src/webapp.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/webapp.rs b/src/webapp.rs index a0f706d..5d0023d 100644 --- a/src/webapp.rs +++ b/src/webapp.rs @@ -3,7 +3,6 @@ use rocket::State; use rocket::response::Content; use rocket::http::ContentType; use rocket_contrib::Json; -use schala_lang; use language::{ProgrammingLanguageInterface, EvalOptions}; use WEBFILES; use ::PLIGenerator; @@ -34,14 +33,12 @@ struct Output { } #[post("/input", format = "application/json", data = "")] -fn interpreter_input(input: Json) -> Json { - let mut schala = schala_lang::Schala::new(); +fn interpreter_input(input: Json, schala_gen: State>) -> Json { + let mut schala: Box = schala_gen.lock().unwrap()(); 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) { - let wrapped_func = Mutex::new(func); - //let wrapped_func = Box::new(|| { 5 }); - rocket::ignite().manage(wrapped_func).mount("/", routes![index, js_bundle, interpreter_input]).launch(); + rocket::ignite().manage(Mutex::new(func)).mount("/", routes![index, js_bundle, interpreter_input]).launch(); }