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

This commit is contained in:
Sergio Benitez 2019-05-16 13:29:06 -07:00
parent f4548f09af
commit 8afe5d3eaf
2 changed files with 6 additions and 6 deletions

View File

@ -5,5 +5,5 @@ workspace = "../.."
publish = false
[dependencies]
crossbeam = "0.5"
crossbeam = "0.7"
rocket = { path = "../../core/lib" }

View File

@ -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() {