diff --git a/examples/managed_queue/Cargo.toml b/examples/managed_queue/Cargo.toml index 69d0306d..c2041ac3 100644 --- a/examples/managed_queue/Cargo.toml +++ b/examples/managed_queue/Cargo.toml @@ -5,5 +5,5 @@ workspace = "../.." publish = false [dependencies] -crossbeam = "0.5" +crossbeam = "0.7" rocket = { path = "../../core/lib" } diff --git a/examples/managed_queue/src/main.rs b/examples/managed_queue/src/main.rs index 5e2c4300..809dd353 100644 --- a/examples/managed_queue/src/main.rs +++ b/examples/managed_queue/src/main.rs @@ -6,9 +6,9 @@ extern crate crossbeam; #[cfg(test)] mod tests; use rocket::State; -use crossbeam::queue::MsQueue; +use crossbeam::queue::SegQueue; -struct LogChannel(MsQueue); +struct LogChannel(SegQueue); #[put("/push?")] fn push(event: String, queue: State) { @@ -16,14 +16,14 @@ fn push(event: String, queue: State) { } #[get("/pop")] -fn pop(queue: State) -> String { - queue.0.pop() +fn pop(queue: State) -> Option { + queue.0.pop().ok() } fn rocket() -> rocket::Rocket { rocket::ignite() .mount("/", routes![push, pop]) - .manage(LogChannel(MsQueue::new())) + .manage(LogChannel(SegQueue::new())) } fn main() {