2021-11-19 21:32:07 +01:00
|
|
|
use axum::{
|
|
|
|
async_trait,
|
2023-03-20 21:02:40 +01:00
|
|
|
extract::{Request, FromRequest},
|
2021-11-19 21:32:07 +01:00
|
|
|
};
|
2022-01-26 23:27:22 +01:00
|
|
|
use axum_macros::debug_handler;
|
2021-11-11 21:26:08 +01:00
|
|
|
|
|
|
|
struct A;
|
|
|
|
|
|
|
|
#[async_trait]
|
2023-03-12 16:37:32 +01:00
|
|
|
impl<S> FromRequest<S> for A
|
2021-11-30 14:46:13 +01:00
|
|
|
where
|
2022-08-17 22:08:24 +02:00
|
|
|
S: Send + Sync,
|
2021-11-30 14:46:13 +01:00
|
|
|
{
|
2021-11-11 21:26:08 +01:00
|
|
|
type Rejection = ();
|
|
|
|
|
2023-03-20 21:02:40 +01:00
|
|
|
async fn from_request(_req: Request, _state: &S) -> Result<Self, Self::Rejection> {
|
2022-08-22 12:23:20 +02:00
|
|
|
unimplemented!()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[async_trait]
|
2023-03-12 16:37:32 +01:00
|
|
|
impl<S> FromRequest<S> for Box<A>
|
2022-08-22 12:23:20 +02:00
|
|
|
where
|
|
|
|
S: Send + Sync,
|
|
|
|
{
|
|
|
|
type Rejection = ();
|
|
|
|
|
2023-03-20 21:02:40 +01:00
|
|
|
async fn from_request(_req: Request, _state: &S) -> Result<Self, Self::Rejection> {
|
2021-11-11 21:26:08 +01:00
|
|
|
unimplemented!()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl A {
|
|
|
|
#[debug_handler]
|
|
|
|
async fn handler(self) {}
|
2022-08-22 12:23:20 +02:00
|
|
|
|
|
|
|
#[debug_handler]
|
|
|
|
async fn handler_with_qualified_self(self: Box<Self>) {}
|
2021-11-11 21:26:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|