mirror of
https://github.com/tokio-rs/axum.git
synced 2024-12-29 07:48:39 +01:00
e7f1c88cd4
* Add extension and state benchmarks * wip * Arc the state everywhere * don't require `S: Clone` * fix example
38 lines
756 B
Rust
38 lines
756 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<S, B> FromRequest<S, B> for OtherExtractor
|
|
where
|
|
B: Send,
|
|
S: Send + Sync,
|
|
{
|
|
type Rejection = OtherExtractorRejection;
|
|
|
|
async fn from_request(_req: &mut RequestParts<S, B>) -> Result<Self, Self::Rejection> {
|
|
unimplemented!()
|
|
}
|
|
}
|
|
|
|
#[derive(Debug)]
|
|
struct OtherExtractorRejection;
|
|
|
|
impl IntoResponse for OtherExtractorRejection {
|
|
fn into_response(self) -> Response {
|
|
unimplemented!()
|
|
}
|
|
}
|
|
|
|
fn main() {}
|