mirror of
https://github.com/tokio-rs/axum.git
synced 2026-09-08 00:00:24 +02:00
Remove B type param (#1751)
Co-authored-by: Jonas Platte <[email protected]> Co-authored-by: Michael Scofield <[email protected]>
This commit is contained in:
co-authored by
Jonas Platte
Michael Scofield
parent
f902f7470f
commit
a4b7d3843c
@@ -1,4 +1,4 @@
|
||||
use axum::{body::Body, routing::get, Router};
|
||||
use axum::{routing::get, Router};
|
||||
use axum_macros::FromRequest;
|
||||
|
||||
#[derive(FromRequest, Clone)]
|
||||
@@ -7,5 +7,5 @@ struct Extractor<T>(T);
|
||||
async fn foo(_: Extractor<()>) {}
|
||||
|
||||
fn main() {
|
||||
Router::<(), Body>::new().route("/", get(foo));
|
||||
_ = Router::<()>::new().route("/", get(foo));
|
||||
}
|
||||
|
||||
@@ -4,21 +4,21 @@ error: #[derive(FromRequest)] only supports generics when used with #[from_reque
|
||||
5 | struct Extractor<T>(T);
|
||||
| ^
|
||||
|
||||
error[E0277]: the trait bound `fn(Extractor<()>) -> impl Future<Output = ()> {foo}: Handler<_, _, _>` is not satisfied
|
||||
--> tests/from_request/fail/generic_without_via.rs:10:46
|
||||
|
|
||||
10 | Router::<(), Body>::new().route("/", get(foo));
|
||||
| --- ^^^ the trait `Handler<_, _, _>` is not implemented for fn item `fn(Extractor<()>) -> impl Future<Output = ()> {foo}`
|
||||
| |
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
= note: Consider using `#[axum::debug_handler]` to improve the error message
|
||||
= help: the following other types implement trait `Handler<T, S, B>`:
|
||||
<Layered<L, H, T, S, B, B2> as Handler<T, S, B2>>
|
||||
<MethodRouter<S, B> as Handler<(), S, B>>
|
||||
error[E0277]: the trait bound `fn(Extractor<()>) -> impl Future<Output = ()> {foo}: Handler<_, _>` is not satisfied
|
||||
--> tests/from_request/fail/generic_without_via.rs:10:44
|
||||
|
|
||||
10 | _ = Router::<()>::new().route("/", get(foo));
|
||||
| --- ^^^ the trait `Handler<_, _>` is not implemented for fn item `fn(Extractor<()>) -> impl Future<Output = ()> {foo}`
|
||||
| |
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
= note: Consider using `#[axum::debug_handler]` to improve the error message
|
||||
= help: the following other types implement trait `Handler<T, S>`:
|
||||
<Layered<L, H, T, S> as Handler<T, S>>
|
||||
<MethodRouter<S> as Handler<(), S>>
|
||||
note: required by a bound in `axum::routing::get`
|
||||
--> $WORKSPACE/axum/src/routing/method_routing.rs
|
||||
|
|
||||
| top_level_handler_fn!(get, GET);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `axum::routing::get`
|
||||
= note: this error originates in the macro `top_level_handler_fn` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
--> $WORKSPACE/axum/src/routing/method_routing.rs
|
||||
|
|
||||
| top_level_handler_fn!(get, GET);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `axum::routing::get`
|
||||
= note: this error originates in the macro `top_level_handler_fn` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use axum::{body::Body, routing::get, Router};
|
||||
use axum::{routing::get, Router};
|
||||
use axum_macros::FromRequest;
|
||||
|
||||
#[derive(FromRequest, Clone)]
|
||||
@@ -8,5 +8,5 @@ struct Extractor<T>(T);
|
||||
async fn foo(_: Extractor<()>) {}
|
||||
|
||||
fn main() {
|
||||
Router::<(), Body>::new().route("/", get(foo));
|
||||
_ = Router::<()>::new().route("/", get(foo));
|
||||
}
|
||||
|
||||
@@ -4,21 +4,21 @@ error: #[derive(FromRequest)] only supports generics when used with #[from_reque
|
||||
6 | struct Extractor<T>(T);
|
||||
| ^
|
||||
|
||||
error[E0277]: the trait bound `fn(Extractor<()>) -> impl Future<Output = ()> {foo}: Handler<_, _, _>` is not satisfied
|
||||
--> tests/from_request/fail/generic_without_via_rejection.rs:11:46
|
||||
|
|
||||
11 | Router::<(), Body>::new().route("/", get(foo));
|
||||
| --- ^^^ the trait `Handler<_, _, _>` is not implemented for fn item `fn(Extractor<()>) -> impl Future<Output = ()> {foo}`
|
||||
| |
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
= note: Consider using `#[axum::debug_handler]` to improve the error message
|
||||
= help: the following other types implement trait `Handler<T, S, B>`:
|
||||
<Layered<L, H, T, S, B, B2> as Handler<T, S, B2>>
|
||||
<MethodRouter<S, B> as Handler<(), S, B>>
|
||||
error[E0277]: the trait bound `fn(Extractor<()>) -> impl Future<Output = ()> {foo}: Handler<_, _>` is not satisfied
|
||||
--> tests/from_request/fail/generic_without_via_rejection.rs:11:44
|
||||
|
|
||||
11 | _ = Router::<()>::new().route("/", get(foo));
|
||||
| --- ^^^ the trait `Handler<_, _>` is not implemented for fn item `fn(Extractor<()>) -> impl Future<Output = ()> {foo}`
|
||||
| |
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
= note: Consider using `#[axum::debug_handler]` to improve the error message
|
||||
= help: the following other types implement trait `Handler<T, S>`:
|
||||
<Layered<L, H, T, S> as Handler<T, S>>
|
||||
<MethodRouter<S> as Handler<(), S>>
|
||||
note: required by a bound in `axum::routing::get`
|
||||
--> $WORKSPACE/axum/src/routing/method_routing.rs
|
||||
|
|
||||
| top_level_handler_fn!(get, GET);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `axum::routing::get`
|
||||
= note: this error originates in the macro `top_level_handler_fn` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
--> $WORKSPACE/axum/src/routing/method_routing.rs
|
||||
|
|
||||
| top_level_handler_fn!(get, GET);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `axum::routing::get`
|
||||
= note: this error originates in the macro `top_level_handler_fn` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
@@ -4,18 +4,18 @@ error: cannot use `rejection` without `via`
|
||||
18 | #[from_request(rejection(MyRejection))]
|
||||
| ^^^^^^^^^
|
||||
|
||||
error[E0277]: the trait bound `fn(MyExtractor) -> impl Future<Output = ()> {handler}: Handler<_, _, _>` is not satisfied
|
||||
error[E0277]: the trait bound `fn(MyExtractor) -> impl Future<Output = ()> {handler}: Handler<_, _>` is not satisfied
|
||||
--> tests/from_request/fail/override_rejection_on_enum_without_via.rs:10:50
|
||||
|
|
||||
10 | let _: Router = Router::new().route("/", get(handler).post(handler_result));
|
||||
| --- ^^^^^^^ the trait `Handler<_, _, _>` is not implemented for fn item `fn(MyExtractor) -> impl Future<Output = ()> {handler}`
|
||||
| --- ^^^^^^^ the trait `Handler<_, _>` is not implemented for fn item `fn(MyExtractor) -> impl Future<Output = ()> {handler}`
|
||||
| |
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
= note: Consider using `#[axum::debug_handler]` to improve the error message
|
||||
= help: the following other types implement trait `Handler<T, S, B>`:
|
||||
<Layered<L, H, T, S, B, B2> as Handler<T, S, B2>>
|
||||
<MethodRouter<S, B> as Handler<(), S, B>>
|
||||
= help: the following other types implement trait `Handler<T, S>`:
|
||||
<Layered<L, H, T, S> as Handler<T, S>>
|
||||
<MethodRouter<S> as Handler<(), S>>
|
||||
note: required by a bound in `axum::routing::get`
|
||||
--> $WORKSPACE/axum/src/routing/method_routing.rs
|
||||
|
|
||||
@@ -23,21 +23,21 @@ note: required by a bound in `axum::routing::get`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `axum::routing::get`
|
||||
= note: this error originates in the macro `top_level_handler_fn` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `fn(Result<MyExtractor, MyRejection>) -> impl Future<Output = ()> {handler_result}: Handler<_, _, _>` is not satisfied
|
||||
error[E0277]: the trait bound `fn(Result<MyExtractor, MyRejection>) -> impl Future<Output = ()> {handler_result}: Handler<_, _>` is not satisfied
|
||||
--> tests/from_request/fail/override_rejection_on_enum_without_via.rs:10:64
|
||||
|
|
||||
10 | let _: Router = Router::new().route("/", get(handler).post(handler_result));
|
||||
| ---- ^^^^^^^^^^^^^^ the trait `Handler<_, _, _>` is not implemented for fn item `fn(Result<MyExtractor, MyRejection>) -> impl Future<Output = ()> {handler_result}`
|
||||
| ---- ^^^^^^^^^^^^^^ the trait `Handler<_, _>` is not implemented for fn item `fn(Result<MyExtractor, MyRejection>) -> impl Future<Output = ()> {handler_result}`
|
||||
| |
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
= note: Consider using `#[axum::debug_handler]` to improve the error message
|
||||
= help: the following other types implement trait `Handler<T, S, B>`:
|
||||
<Layered<L, H, T, S, B, B2> as Handler<T, S, B2>>
|
||||
<MethodRouter<S, B> as Handler<(), S, B>>
|
||||
note: required by a bound in `MethodRouter::<S, B>::post`
|
||||
= help: the following other types implement trait `Handler<T, S>`:
|
||||
<Layered<L, H, T, S> as Handler<T, S>>
|
||||
<MethodRouter<S> as Handler<(), S>>
|
||||
note: required by a bound in `MethodRouter::<S>::post`
|
||||
--> $WORKSPACE/axum/src/routing/method_routing.rs
|
||||
|
|
||||
| chained_handler_fn!(post, POST);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `MethodRouter::<S, B>::post`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `MethodRouter::<S>::post`
|
||||
= note: this error originates in the macro `chained_handler_fn` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
@@ -15,7 +15,7 @@ struct OtherState {}
|
||||
|
||||
fn assert_from_request()
|
||||
where
|
||||
Extractor: axum::extract::FromRequest<AppState, axum::body::Body, Rejection = axum::response::Response>,
|
||||
Extractor: axum::extract::FromRequest<AppState, Rejection = axum::response::Response>,
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user