mirror of
https://github.com/tokio-rs/axum.git
synced 2026-09-06 00:00:17 +02:00
Move TypedHeader to axum-extra (#1850)
Co-authored-by: Michael Scofield <[email protected]> Co-authored-by: Jonas Platte <[email protected]>
This commit is contained in:
co-authored by
Michael Scofield
Jonas Platte
parent
173f9f72b0
commit
877e3fe4de
@@ -20,5 +20,5 @@ 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`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `get`
|
||||
= note: this error originates in the macro `top_level_handler_fn` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
@@ -20,5 +20,5 @@ 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`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `get`
|
||||
= note: this error originates in the macro `top_level_handler_fn` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
@@ -5,39 +5,39 @@ error: cannot use `rejection` without `via`
|
||||
| ^^^^^^^^^
|
||||
|
||||
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}`
|
||||
| |
|
||||
| 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>>
|
||||
--> 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}`
|
||||
| |
|
||||
| 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 `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
|
||||
--> 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}`
|
||||
| |
|
||||
| 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>>
|
||||
--> 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}`
|
||||
| |
|
||||
| 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 `MethodRouter::<S>::post`
|
||||
--> $WORKSPACE/axum/src/routing/method_routing.rs
|
||||
|
|
||||
| chained_handler_fn!(post, 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)
|
||||
--> $WORKSPACE/axum/src/routing/method_routing.rs
|
||||
|
|
||||
| chained_handler_fn!(post, 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,4 +15,4 @@ error[E0277]: the trait bound `String: FromRequestParts<S>` is not satisfied
|
||||
<(T1, T2, T3, T4, T5, T6) as FromRequestParts<S>>
|
||||
<(T1, T2, T3, T4, T5, T6, T7) as FromRequestParts<S>>
|
||||
<(T1, T2, T3, T4, T5, T6, T7, T8) as FromRequestParts<S>>
|
||||
and 27 others
|
||||
and $N others
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
use axum::{
|
||||
extract::{FromRequest, TypedHeader, rejection::TypedHeaderRejection},
|
||||
extract::FromRequest,
|
||||
response::Response,
|
||||
};
|
||||
use axum_extra::{
|
||||
TypedHeader,
|
||||
typed_header::TypedHeaderRejection,
|
||||
headers::{self, UserAgent},
|
||||
};
|
||||
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
use axum::{
|
||||
extract::{rejection::TypedHeaderRejection, FromRequestParts, TypedHeader},
|
||||
headers::{self, UserAgent},
|
||||
extract::FromRequestParts,
|
||||
response::Response,
|
||||
};
|
||||
use axum_extra::{
|
||||
TypedHeader,
|
||||
typed_header::TypedHeaderRejection,
|
||||
headers::{self, UserAgent},
|
||||
};
|
||||
|
||||
#[derive(FromRequestParts)]
|
||||
struct Extractor {
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
use axum::{
|
||||
response::Response,
|
||||
extract::{
|
||||
rejection::TypedHeaderRejection,
|
||||
Extension, FromRequest, TypedHeader,
|
||||
},
|
||||
extract::{Extension, FromRequest},
|
||||
};
|
||||
use axum_extra::{
|
||||
TypedHeader,
|
||||
typed_header::TypedHeaderRejection,
|
||||
headers::{self, UserAgent},
|
||||
};
|
||||
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
use axum::{
|
||||
response::Response,
|
||||
extract::{
|
||||
rejection::TypedHeaderRejection,
|
||||
Extension, FromRequestParts, TypedHeader,
|
||||
},
|
||||
extract::{Extension, FromRequestParts},
|
||||
};
|
||||
use axum_extra::{
|
||||
TypedHeader,
|
||||
typed_header::TypedHeaderRejection,
|
||||
headers::{self, UserAgent},
|
||||
};
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ use axum::{
|
||||
http::StatusCode,
|
||||
response::{IntoResponse, Response},
|
||||
routing::get,
|
||||
body::Body,
|
||||
Extension, Router,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user