1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-07-06 14:05:47 +00: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);
impl<T> Form<T> {
/// Deconstruct to an inner value
pub fn into_inner(self) -> T {
self.0
}
}
impl<T> Deref for Form<T> {
type Target = T;

View file

@ -22,6 +22,13 @@ use httpresponse::HttpResponse;
/// and second is for extracting typed information from request's payload.
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> {
type Target = T;