mirror of
https://github.com/tokio-rs/axum.git
synced 2026-08-28 00:00:20 +02:00
Remove unneeded bounds on S in FromRequest(Parts) implementations
This doesn't actually allow using non-Send or non-Sync state types, but it makes the docs simpler.
This commit is contained in:
@@ -116,13 +116,10 @@ impl A {
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
impl<S> FromRequestParts<S> for A
|
||||
where
|
||||
S: Send + Sync,
|
||||
{
|
||||
impl<S> FromRequestParts<S> for A {
|
||||
type Rejection = ();
|
||||
|
||||
async fn from_request_parts(_parts: &mut Parts, _state: &S) -> Result<Self, Self::Rejection> {
|
||||
async fn from_request_parts(_parts: &mut Parts, _: &S) -> Result<Self, Self::Rejection> {
|
||||
unimplemented!()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
use axum::{
|
||||
async_trait,
|
||||
extract::FromRequest,
|
||||
http::Request,
|
||||
};
|
||||
use axum::{async_trait, extract::FromRequest, http::Request};
|
||||
use axum_macros::debug_handler;
|
||||
|
||||
struct A;
|
||||
@@ -11,11 +7,10 @@ struct A;
|
||||
impl<S, B> FromRequest<S, B> 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<B>, _: &S) -> Result<Self, Self::Rejection> {
|
||||
unimplemented!()
|
||||
}
|
||||
}
|
||||
@@ -24,11 +19,10 @@ where
|
||||
impl<S, B> FromRequest<S, B> 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<B>, _: &S) -> Result<Self, Self::Rejection> {
|
||||
unimplemented!()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use axum_macros::debug_handler;
|
||||
use axum::extract::{FromRef, FromRequest};
|
||||
use axum::async_trait;
|
||||
use axum::extract::{FromRef, FromRequest};
|
||||
use axum::http::Request;
|
||||
use axum_macros::debug_handler;
|
||||
|
||||
#[debug_handler(state = AppState)]
|
||||
async fn handler(_: A) {}
|
||||
@@ -15,12 +15,11 @@ struct A;
|
||||
impl<S, B> FromRequest<S, B> 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<B>, _: &S) -> Result<Self, Self::Rejection> {
|
||||
unimplemented!()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user