mirror of https://github.com/rwf2/Rocket.git
Update 'crossbeam' to 0.7 in 'managed_queue' example.
This commit is contained in:
parent
f4548f09af
commit
8afe5d3eaf
|
@ -5,5 +5,5 @@ workspace = "../.."
|
|||
publish = false
|
||||
|
||||
[dependencies]
|
||||
crossbeam = "0.5"
|
||||
crossbeam = "0.7"
|
||||
rocket = { path = "../../core/lib" }
|
||||
|
|
|
@ -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() {
|
||||
|
|
Loading…
Reference in New Issue