axum/extract/
raw_query.rs
1use super::FromRequestParts;
2use async_trait::async_trait;
3use http::request::Parts;
4use std::convert::Infallible;
5
6#[derive(Debug)]
26pub struct RawQuery(pub Option<String>);
27
28#[async_trait]
29impl<S> FromRequestParts<S> for RawQuery
30where
31 S: Send + Sync,
32{
33 type Rejection = Infallible;
34
35 async fn from_request_parts(parts: &mut Parts, _state: &S) -> Result<Self, Self::Rejection> {
36 let query = parts.uri.query().map(|query| query.to_owned());
37 Ok(Self(query))
38 }
39}