aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/request.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/request.rs b/src/request.rs
index 4f45e04..19292a1 100644
--- a/src/request.rs
+++ b/src/request.rs
@@ -1,7 +1,7 @@
//! Provides the [`SputnikParts`] trait.
use mime::Mime;
-use serde::de::DeserializeOwned;
+use serde::Deserialize;
use std::str::Split;
use std::time::Duration;
@@ -11,7 +11,7 @@ use crate::http::{HeaderMap, header, request::Parts};
/// Adds convenience methods to [`http::request::Parts`](Parts).
pub trait SputnikParts {
/// Parses the query string of the request into a given struct.
- fn query<X: DeserializeOwned>(&self) -> Result<X,QueryError>;
+ fn query<'a, X: Deserialize<'a>>(&'a self) -> Result<X,QueryError>;
/// Parses the cookies of the request.
fn cookies(&self) -> CookieIter;
@@ -52,7 +52,7 @@ impl<'a> Iterator for CookieIter<'a> {
}
impl SputnikParts for Parts {
- fn query<T: DeserializeOwned>(&self) -> Result<T,QueryError> {
+ fn query<'a, T: Deserialize<'a>>(&'a self) -> Result<T,QueryError> {
serde_urlencoded::from_str::<T>(self.uri.query().unwrap_or("")).map_err(QueryError)
}