1
0
mirror of https://github.com/fafhrd91/actix-web synced 2024-11-27 17:52:56 +01:00

add helper method for returning inner value

This commit is contained in:
Nikolay Kim 2018-04-12 15:55:15 -07:00
parent 2ca0ea70c4
commit 94c5bb5cdd
2 changed files with 14 additions and 0 deletions

View File

@ -211,6 +211,13 @@ impl<T, S> FromRequest<S> for Query<T>
/// ``` /// ```
pub struct Form<T>(pub T); pub struct Form<T>(pub T);
impl<T> Form<T> {
/// Deconstruct to an inner value
pub fn into_inner(self) -> T {
self.0
}
}
impl<T> Deref for Form<T> { impl<T> Deref for Form<T> {
type Target = T; type Target = T;

View File

@ -22,6 +22,13 @@ use httpresponse::HttpResponse;
/// and second is for extracting typed information from request's payload. /// and second is for extracting typed information from request's payload.
pub struct Json<T>(pub T); pub struct Json<T>(pub T);
impl<T> Json<T> {
/// Deconstruct to an inner value
pub fn into_inner(self) -> T {
self.0
}
}
impl<T> Deref for Json<T> { impl<T> Deref for Json<T> {
type Target = T; type Target = T;