Skip to content

Commit

Permalink
Update 'crossbeam' to 0.7 in 'managed_queue' example.
Browse files Browse the repository at this point in the history
  • Loading branch information
SergioBenitez committed May 16, 2019
1 parent 59d8cfa commit 868a7e6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion examples/managed_queue/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ workspace = "../.."
publish = false

[dependencies]
crossbeam = "0.5"
crossbeam = "0.7"
rocket = { path = "../../core/lib" }
10 changes: 5 additions & 5 deletions examples/managed_queue/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,24 @@ 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>) {
queue.0.push(event);
}

#[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() {
Expand Down

0 comments on commit 868a7e6

Please sign in to comment.