Remove B type param (#1751)

Co-authored-by: Jonas Platte <[email protected]>
Co-authored-by: Michael Scofield <[email protected]>
This commit is contained in:
David Pedersen
2023-04-21 17:45:31 +02:00
co-authored by Jonas Platte Michael Scofield
parent 9be0ea934c
commit 4e4c29175f
100 changed files with 966 additions and 1160 deletions
@@ -1,10 +0,0 @@
use axum::{body::BoxBody, http::Request};
use axum_macros::debug_handler;
#[debug_handler(body = BoxBody)]
async fn handler(_: Request<BoxBody>) {}
#[debug_handler(body = axum::body::BoxBody,)]
async fn handler_with_trailing_comma_and_type_path(_: Request<axum::body::BoxBody>) {}
fn main() {}
@@ -8,27 +8,25 @@ use axum_macros::debug_handler;
struct A;
#[async_trait]
impl<S, B> FromRequest<S, B> for A
impl<S> FromRequest<S> for A
where
B: Send + 'static,
S: Send + Sync,
{
type Rejection = ();
async fn from_request(_req: Request<B>, _state: &S) -> Result<Self, Self::Rejection> {
async fn from_request(_req: Request<axum::body::Body>, _state: &S) -> Result<Self, Self::Rejection> {
unimplemented!()
}
}
#[async_trait]
impl<S, B> FromRequest<S, B> for Box<A>
impl<S> FromRequest<S> for Box<A>
where
B: Send + 'static,
S: Send + Sync,
{
type Rejection = ();
async fn from_request(_req: Request<B>, _state: &S) -> Result<Self, Self::Rejection> {
async fn from_request(_req: Request<axum::body::Body>, _state: &S) -> Result<Self, Self::Rejection> {
unimplemented!()
}
}
@@ -12,15 +12,14 @@ struct AppState;
struct A;
#[async_trait]
impl<S, B> FromRequest<S, B> for A
impl<S> FromRequest<S> for A
where
B: Send + 'static,
S: Send + Sync,
AppState: FromRef<S>,
{
type Rejection = ();
async fn from_request(_req: Request<B>, _state: &S) -> Result<Self, Self::Rejection> {
async fn from_request(_req: Request<axum::body::Body>, _state: &S) -> Result<Self, Self::Rejection> {
unimplemented!()
}
}
@@ -1,8 +1,8 @@
use axum_macros::debug_handler;
use axum::{body::BoxBody, extract::State, http::Request};
use axum::{extract::State, http::Request};
#[debug_handler(state = AppState, body = BoxBody)]
async fn handler(_: State<AppState>, _: Request<BoxBody>) {}
#[debug_handler(state = AppState)]
async fn handler(_: State<AppState>, _: Request<axum::body::Body>) {}
#[derive(Clone)]
struct AppState;