diff options
author | Martin Fischer <martin@push-f.com> | 2021-01-29 11:38:33 +0100 |
---|---|---|
committer | Martin Fischer <martin@push-f.com> | 2021-01-29 11:38:57 +0100 |
commit | 10b5cd07f07cefd15450001375cd1c3e6927cc8a (patch) | |
tree | 8bd05662b4eacb54f6537c18788a33f861714fc3 /src/request.rs | |
parent | 6c44846f6bf5901eaa12b943646632bd2163c898 (diff) |
add documentation
Diffstat (limited to 'src/request.rs')
-rw-r--r-- | src/request.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/request.rs b/src/request.rs index 195e601..d89248c 100644 --- a/src/request.rs +++ b/src/request.rs @@ -13,6 +13,7 @@ use crate::response::{SputnikHeaders, delete_cookie}; const CSRF_COOKIE_NAME : &str = "csrf"; +/// 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>; @@ -32,7 +33,7 @@ pub trait SputnikParts { fn response_headers(&mut self) -> &mut HeaderMap; } -impl SputnikParts for hyper::http::request::Parts { +impl SputnikParts for Parts { fn query<T: DeserializeOwned>(&self) -> Result<T,QueryError> { serde_urlencoded::from_str::<T>(self.uri.query().unwrap_or("")).map_err(QueryError) } @@ -185,6 +186,7 @@ impl CsrfToken { } } +/// Adds deserialization methods to [`hyper::Body`]. #[async_trait] pub trait SputnikBody { async fn into_bytes(self) -> Result<Bytes, BodyError>; |