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
9be0ea934c
commit
4e4c29175f
@@ -1,5 +1,4 @@
|
||||
use axum::{
|
||||
body::Body,
|
||||
extract::{FromRequest, Json},
|
||||
response::Response,
|
||||
};
|
||||
@@ -15,7 +14,7 @@ struct Extractor {
|
||||
|
||||
fn assert_from_request()
|
||||
where
|
||||
Extractor: FromRequest<(), Body, Rejection = Response>,
|
||||
Extractor: FromRequest<(), Rejection = Response>,
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ struct Extractor {}
|
||||
|
||||
fn assert_from_request()
|
||||
where
|
||||
Extractor: axum::extract::FromRequest<(), axum::body::Body, Rejection = std::convert::Infallible>,
|
||||
Extractor: axum::extract::FromRequest<(), Rejection = std::convert::Infallible>,
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ struct Extractor();
|
||||
|
||||
fn assert_from_request()
|
||||
where
|
||||
Extractor: axum::extract::FromRequest<(), axum::body::Body, Rejection = std::convert::Infallible>,
|
||||
Extractor: axum::extract::FromRequest<(), Rejection = std::convert::Infallible>,
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use axum::{body::Body, routing::get, Extension, Router};
|
||||
use axum::{routing::get, Extension, Router};
|
||||
use axum_macros::FromRequest;
|
||||
|
||||
#[derive(FromRequest, Clone)]
|
||||
@@ -8,5 +8,5 @@ enum Extractor {}
|
||||
async fn foo(_: Extractor) {}
|
||||
|
||||
fn main() {
|
||||
Router::<(), Body>::new().route("/", get(foo));
|
||||
_ = Router::<()>::new().route("/", get(foo));
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use axum::{body::Body, routing::get, Extension, Router};
|
||||
use axum::{routing::get, Extension, Router};
|
||||
use axum_macros::FromRequestParts;
|
||||
|
||||
#[derive(FromRequestParts, Clone)]
|
||||
@@ -8,5 +8,5 @@ enum Extractor {}
|
||||
async fn foo(_: Extractor) {}
|
||||
|
||||
fn main() {
|
||||
Router::<(), Body>::new().route("/", get(foo));
|
||||
_ = Router::<()>::new().route("/", get(foo));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
use axum::{
|
||||
body::Body,
|
||||
extract::{FromRequest, TypedHeader, rejection::TypedHeaderRejection},
|
||||
response::Response,
|
||||
headers::{self, UserAgent},
|
||||
@@ -17,7 +16,7 @@ struct Extractor {
|
||||
|
||||
fn assert_from_request()
|
||||
where
|
||||
Extractor: FromRequest<(), Body, Rejection = Response>,
|
||||
Extractor: FromRequest<(), Rejection = Response>,
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
use axum::{
|
||||
body::Body,
|
||||
response::Response,
|
||||
extract::{
|
||||
rejection::TypedHeaderRejection,
|
||||
@@ -24,7 +23,7 @@ struct Extractor {
|
||||
|
||||
fn assert_from_request()
|
||||
where
|
||||
Extractor: FromRequest<(), Body, Rejection = Response>,
|
||||
Extractor: FromRequest<(), Rejection = Response>,
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ use axum::{
|
||||
http::{StatusCode, Request},
|
||||
response::{IntoResponse, Response},
|
||||
routing::get,
|
||||
body::Body,
|
||||
Extension, Router,
|
||||
};
|
||||
|
||||
@@ -27,15 +28,14 @@ struct MyExtractor {
|
||||
struct OtherExtractor;
|
||||
|
||||
#[async_trait]
|
||||
impl<S, B> FromRequest<S, B> for OtherExtractor
|
||||
impl<S> FromRequest<S> for OtherExtractor
|
||||
where
|
||||
B: Send + 'static,
|
||||
S: Send + Sync,
|
||||
{
|
||||
// this rejection doesn't implement `Display` and `Error`
|
||||
type Rejection = (StatusCode, String);
|
||||
|
||||
async fn from_request(_req: Request<B>, _state: &S) -> Result<Self, Self::Rejection> {
|
||||
async fn from_request(_req: Request<Body>, _state: &S) -> Result<Self, Self::Rejection> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ impl FromRef<AppState> for Key {
|
||||
|
||||
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>,
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ struct AppState {}
|
||||
|
||||
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>,
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ struct AppState {}
|
||||
|
||||
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>,
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ struct Extractor(axum::http::HeaderMap, String);
|
||||
|
||||
fn assert_from_request()
|
||||
where
|
||||
Extractor: axum::extract::FromRequest<(), axum::body::Body>,
|
||||
Extractor: axum::extract::FromRequest<()>,
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ struct Payload {}
|
||||
|
||||
fn assert_from_request()
|
||||
where
|
||||
Extractor: axum::extract::FromRequest<(), axum::body::Body>,
|
||||
Extractor: axum::extract::FromRequest<()>,
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ struct Payload {}
|
||||
|
||||
fn assert_from_request()
|
||||
where
|
||||
Extractor: axum::extract::FromRequest<(), axum::body::Body, Rejection = Response>,
|
||||
Extractor: axum::extract::FromRequest<(), Rejection = Response>,
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ struct State;
|
||||
|
||||
fn assert_from_request()
|
||||
where
|
||||
Extractor: axum::extract::FromRequest<(), axum::body::Body>,
|
||||
Extractor: axum::extract::FromRequest<()>,
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ struct Extractor;
|
||||
|
||||
fn assert_from_request()
|
||||
where
|
||||
Extractor: axum::extract::FromRequest<(), axum::body::Body, Rejection = std::convert::Infallible>,
|
||||
Extractor: axum::extract::FromRequest<(), Rejection = std::convert::Infallible>,
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user