11use axum:: {
2- extract:: { FromRequestParts , OptionalFromRequestParts } ,
2+ extract:: FromRequestParts ,
33 response:: { IntoResponse , Response } ,
44 Error ,
55} ;
@@ -18,19 +18,6 @@ use std::fmt;
1818/// with the `multiple` attribute. Those values can be collected into a `Vec` or other sequential
1919/// container.
2020///
21- /// # `Option<Query<T>>` behavior
22- ///
23- /// If `Query<T>` itself is used as an extractor and there is no query string in
24- /// the request URL, `T`'s `Deserialize` implementation is called on an empty
25- /// string instead.
26- ///
27- /// You can avoid this by using `Option<Query<T>>`, which gives you `None` in
28- /// the case that there is no query string in the request URL.
29- ///
30- /// Note that an empty query string is not the same as no query string, that is
31- /// `https://example.org/` and `https://example.org/?` are not treated the same
32- /// in this case.
33- ///
3421/// # Example
3522///
3623/// ```rust,no_run
@@ -109,27 +96,6 @@ where
10996 }
11097}
11198
112- impl < T , S > OptionalFromRequestParts < S > for Query < T >
113- where
114- T : DeserializeOwned ,
115- S : Send + Sync ,
116- {
117- type Rejection = QueryRejection ;
118-
119- async fn from_request_parts (
120- parts : & mut Parts ,
121- _state : & S ,
122- ) -> Result < Option < Self > , Self :: Rejection > {
123- if let Some ( query) = parts. uri . query ( ) {
124- let value = serde_html_form:: from_str ( query)
125- . map_err ( |err| QueryRejection :: FailedToDeserializeQueryString ( Error :: new ( err) ) ) ?;
126- Ok ( Some ( Self ( value) ) )
127- } else {
128- Ok ( None )
129- }
130- }
131- }
132-
13399axum_core:: __impl_deref!( Query ) ;
134100
135101/// Rejection used for [`Query`].
0 commit comments