#![feature(proc_macro_hygiene)] #[macro_use] extern crate rocket; #[cfg(test)] mod tests; use rocket::State; use crossbeam::queue::SegQueue; struct LogChannel(SegQueue); #[put("/push?")] fn push(event: String, queue: State<'_, LogChannel>) { queue.0.push(event); } #[get("/pop")] fn pop(queue: State<'_, LogChannel>) -> Option { queue.0.pop().ok() } fn rocket() -> rocket::Rocket { rocket::ignite() .mount("/", routes![push, pop]) .manage(LogChannel(SegQueue::new())) } #[rocket::main] async fn main() { let _ = rocket().launch().await; }