#![feature(plugin, decl_macro, proc_macro_non_items)] #![plugin(rocket_codegen)] extern crate crossbeam; #[macro_use] extern crate rocket; #[cfg(test)] mod tests; use crossbeam::queue::MsQueue; use rocket::State; #[derive(FromForm, Debug)] struct Event { description: String } struct LogChannel(MsQueue); #[put("/push?")] fn push(event: Event, queue: State) { queue.0.push(event); } #[get("/pop")] fn pop(queue: State) -> String { let queue = &queue.0; queue.pop().description } fn rocket() -> rocket::Rocket { rocket::ignite() .mount("/", routes![push, pop]) .manage(LogChannel(MsQueue::new())) } fn main() { rocket().launch(); }