From d19541b3e147bec2b7571ba8d0f48a1e1f2065d4 Mon Sep 17 00:00:00 2001 From: greg Date: Mon, 23 Oct 2017 20:51:08 -0700 Subject: [PATCH] Splitting up some code In preparation for splitting schala into crates --- src/main.rs | 6 +++++- src/webapp.rs | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 68534ac..c12c13f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -41,6 +41,10 @@ fn main() { Box::new(maaru_lang::Maaru::new()), Box::new(robo_lang::Robo::new()), ]; + schala_main(languages); +} + +fn schala_main(languages: Vec>) { let option_matches = program_options().parse(std::env::args()).unwrap_or_else(|e| { println!("{:?}", e); @@ -60,7 +64,7 @@ fn main() { } if option_matches.opt_present("webapp") { - webapp::web_main(); + webapp::web_main(languages); exit(0); } diff --git a/src/webapp.rs b/src/webapp.rs index e35bac3..303aea5 100644 --- a/src/webapp.rs +++ b/src/webapp.rs @@ -38,6 +38,6 @@ fn interpreter_input(input: Json) -> Json { Json(Output { text: code_output.to_string() }) } -pub fn web_main() { +pub fn web_main(languages: Vec>) { rocket::ignite().mount("/", routes![index, js_bundle, interpreter_input]).launch(); }