mirror of
https://github.com/actix/actix-web.git
synced 2024-12-22 08:07:18 +00:00
add helper method for returning inner value
This commit is contained in:
parent
2ca0ea70c4
commit
94c5bb5cdd
2 changed files with 14 additions and 0 deletions
|
@ -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;
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue