axum/axum-macros/tests/debug_handler/pass/set_state.rs
David Pedersen 568394a28e
Support changing state type in #[debug_handler] (#1271)
* support setting body type for #[debug_handler]

* Use lookahead1 to give better errors and detect duplicate arguments

* fix docs link
2022-08-18 11:41:14 +02:00

27 lines
503 B
Rust

use axum_macros::debug_handler;
use axum::extract::{FromRef, FromRequest, RequestParts};
use axum::async_trait;
#[debug_handler(state = AppState)]
async fn handler(_: A) {}
#[derive(Clone)]
struct AppState;
struct A;
#[async_trait]
impl<S, B> FromRequest<S, B> for A
where
B: Send,
S: Send + Sync,
AppState: FromRef<S>,
{
type Rejection = ();
async fn from_request(_req: &mut RequestParts<S, B>) -> Result<Self, Self::Rejection> {
unimplemented!()
}
}
fn main() {}