From 94c5bb5cddf95c700b680f9f1bc5a15741029bb5 Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Thu, 12 Apr 2018 15:55:15 -0700 Subject: [PATCH] add helper method for returning inner value --- src/extractor.rs | 7 +++++++ src/json.rs | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/src/extractor.rs b/src/extractor.rs index 1fc6c0784..e88998c79 100644 --- a/src/extractor.rs +++ b/src/extractor.rs @@ -211,6 +211,13 @@ impl FromRequest for Query /// ``` pub struct Form(pub T); +impl Form { + /// Deconstruct to an inner value + pub fn into_inner(self) -> T { + self.0 + } +} + impl Deref for Form { type Target = T; diff --git a/src/json.rs b/src/json.rs index 977c8d183..646a01112 100644 --- a/src/json.rs +++ b/src/json.rs @@ -22,6 +22,13 @@ use httpresponse::HttpResponse; /// and second is for extracting typed information from request's payload. pub struct Json(pub T); +impl Json { + /// Deconstruct to an inner value + pub fn into_inner(self) -> T { + self.0 + } +} + impl Deref for Json { type Target = T;