mirror of
https://github.com/tokio-rs/axum.git
synced 2024-12-19 21:22:13 +01:00
911c4a788e
* Handle structs without fields * Support opt-out of derived rejection traits * Handle duplicate opt outs * Improve error if opting out of `Display` or `Debug` but not `Error` * document `rejection_derive` * Handle using both `via` and `rejection_derive` * don't derive debug for `RejectionDeriveOptOuts` * Update axum-macros/src/from_request.rs Co-authored-by: Jonas Platte <jplatte@users.noreply.github.com> Co-authored-by: Jonas Platte <jplatte@users.noreply.github.com>
37 lines
737 B
Rust
37 lines
737 B
Rust
use axum::{
|
|
async_trait,
|
|
extract::{FromRequest, RequestParts},
|
|
response::{IntoResponse, Response},
|
|
};
|
|
use axum_macros::FromRequest;
|
|
|
|
#[derive(FromRequest)]
|
|
#[from_request(rejection_derive(!Display, !Error))]
|
|
struct Extractor {
|
|
other: OtherExtractor,
|
|
}
|
|
|
|
struct OtherExtractor;
|
|
|
|
#[async_trait]
|
|
impl<B> FromRequest<B> for OtherExtractor
|
|
where
|
|
B: Send + 'static,
|
|
{
|
|
type Rejection = OtherExtractorRejection;
|
|
|
|
async fn from_request(_req: &mut RequestParts<B>) -> Result<Self, Self::Rejection> {
|
|
unimplemented!()
|
|
}
|
|
}
|
|
|
|
#[derive(Debug)]
|
|
struct OtherExtractorRejection;
|
|
|
|
impl IntoResponse for OtherExtractorRejection {
|
|
fn into_response(self) -> Response {
|
|
unimplemented!()
|
|
}
|
|
}
|
|
|
|
fn main() {}
|