From 954f1a0b0fba127b1a68131cea22cbdb22a6ec0c Mon Sep 17 00:00:00 2001 From: Erik Desjardins Date: Mon, 6 Aug 2018 03:44:08 -0400 Subject: [PATCH] impl FromRequest for () (#449) --- src/extractor.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/extractor.rs b/src/extractor.rs index 5c2c7f600..312287e0f 100644 --- a/src/extractor.rs +++ b/src/extractor.rs @@ -690,6 +690,12 @@ macro_rules! tuple_from_req ({$fut_type:ident, $(($n:tt, $T:ident)),+} => { } }); +impl FromRequest for () { + type Config = (); + type Result = Self; + fn from_request(_req: &HttpRequest, _cfg: &Self::Config) -> Self::Result {} +} + tuple_from_req!(TupleFromRequest1, (0, A)); tuple_from_req!(TupleFromRequest2, (0, A), (1, B)); tuple_from_req!(TupleFromRequest3, (0, A), (1, B), (2, C)); @@ -1006,5 +1012,7 @@ mod tests { assert_eq!((res.0).1, "user1"); assert_eq!((res.1).0, "name"); assert_eq!((res.1).1, "user1"); + + let () = <()>::extract(&req); } }