mirror of
https://github.com/actix/actix-extras.git
synced 2024-11-24 16:02:59 +01:00
add helper method for returning inner value
This commit is contained in:
parent
2ca0ea70c4
commit
94c5bb5cdd
@ -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 New Issue
Block a user