From c808364c072f0b1e5fefc59229facce6ef3595c1 Mon Sep 17 00:00:00 2001 From: jesskfullwood <38404589+jesskfullwood@users.noreply.github.com> Date: Fri, 19 Jul 2019 10:47:44 +0100 Subject: [PATCH] make Query payload public (#991) --- CHANGES.md | 4 ++++ src/types/query.rs | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index bc022e388..d56e5ce0f 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -6,6 +6,10 @@ * Re-implement Host predicate (#989) +### Changed + +* `Query` payload made `pub`. Allows user to pattern-match the payload. + ## [1.0.5] - 2019-07-18 diff --git a/src/types/query.rs b/src/types/query.rs index 2ad7106d0..d00f4600d 100644 --- a/src/types/query.rs +++ b/src/types/query.rs @@ -36,7 +36,7 @@ use crate::request::HttpRequest; /// // Use `Query` extractor for query information. /// // This handler get called only if request's query contains `username` field /// // The correct request for this handler would be `/index.html?id=64&response_type=Code"` -/// fn index(info: web::Query) -> String { +/// fn index(web::Query(info): web::Query) -> String { /// format!("Authorization request for client with id={} and type={:?}!", info.id, info.response_type) /// } /// @@ -45,7 +45,7 @@ use crate::request::HttpRequest; /// web::resource("/index.html").route(web::get().to(index))); // <- use `Query` extractor /// } /// ``` -pub struct Query(T); +pub struct Query(pub T); impl Query { /// Deconstruct to a inner value