From b2519208a7fda9642c11c35194c4ca6e294d7201 Mon Sep 17 00:00:00 2001 From: Sergio Benitez Date: Mon, 24 May 2021 14:38:40 -0700 Subject: [PATCH] Synchronize benchmarks with core libraries. --- benchmarks/src/routing.rs | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/benchmarks/src/routing.rs b/benchmarks/src/routing.rs index bbbc6a44..a0521cea 100644 --- a/benchmarks/src/routing.rs +++ b/benchmarks/src/routing.rs @@ -1,11 +1,13 @@ +use std::collections::hash_set::HashSet; + use criterion::Criterion; -use rocket::{handler, Request, Data, Route, Config}; +use rocket::{route, config, Request, Data, Route, Config}; use rocket::http::{Method, RawStr, ContentType, Accept, Status}; use rocket::local::blocking::{Client, LocalRequest}; -fn dummy_handler<'r>(req: &'r Request, _: Data) -> handler::HandlerFuture<'r> { - handler::Outcome::from(req, ()).pin() +fn dummy_handler<'r>(req: &'r Request, _: Data) -> route::BoxFuture<'r> { + route::Outcome::from(req, ()).pin() } fn parse_routes_table(table: &str) -> Vec { @@ -43,12 +45,16 @@ fn generate_matching_requests<'c>(client: &'c Client, routes: &[Route]) -> Vec(client: &'c Client, route: &Route) -> LocalRequest<'c> { - let path = route.uri.raw_path_segments() + let path = route.uri.origin.path() + .raw_segments() .map(staticify_segment) .collect::>() .join("/"); - let query = route.uri.raw_query_segments() + let query = route.uri.origin.query() + .map(|q| q.raw_segments()) + .into_iter() + .flatten() .map(staticify_segment) .collect::>() .join("&"); @@ -76,7 +82,11 @@ fn client(routes: Vec) -> Client { profile: Config::RELEASE_PROFILE, log_level: rocket::config::LogLevel::Off, cli_colors: false, - ctrlc: false, + shutdown: config::Shutdown { + ctrlc: false, + signals: HashSet::new(), + ..Default::default() + }, ..Default::default() };