Rocket

A web framework for Rust. https://rocket.rs (mirror)
git clone git://git.thc420.xyz/Rocket
Log | Files | Refs | README

commit 868a7e642534975a4b374dcdd3909f33a1ccf867
parent 59d8cfab7f5b1b908df8159a91dc5eb29d7027b3
Author: Sergio Benitez <sb@sergio.bz>
Date:   Thu, 16 May 2019 13:29:06 -0700

Update 'crossbeam' to 0.7 in 'managed_queue' example.

Diffstat:
Mexamples/managed_queue/Cargo.toml | 2+-
Mexamples/managed_queue/src/main.rs | 10+++++-----
2 files changed, 6 insertions(+), 6 deletions(-)

diff --git 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 @@ -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<String>); +struct LogChannel(SegQueue<String>); #[put("/push?<event>")] fn push(event: String, queue: State<LogChannel>) { @@ -16,14 +16,14 @@ fn push(event: String, queue: State<LogChannel>) { } #[get("/pop")] -fn pop(queue: State<LogChannel>) -> String { - queue.0.pop() +fn pop(queue: State<LogChannel>) -> Option<String> { + queue.0.pop().ok() } fn rocket() -> rocket::Rocket { rocket::ignite() .mount("/", routes![push, pop]) - .manage(LogChannel(MsQueue::new())) + .manage(LogChannel(SegQueue::new())) } fn main() {