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:
Jonas Platte
2022-11-05 11:04:56 +01:00
parent da058db509
commit 05767b986e
39 changed files with 112 additions and 232 deletions
@@ -1,7 +1,7 @@
use axum::{
async_trait,
extract::{rejection::ExtensionRejection, FromRequest},
http::{StatusCode, Request},
http::{Request, StatusCode},
response::{IntoResponse, Response},
routing::get,
Extension, Router,
@@ -31,12 +31,11 @@ struct OtherExtractor;
impl<S, B> FromRequest<S, B> 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<B>, _: &S) -> Result<Self, Self::Rejection> {
todo!()
}
}
@@ -28,14 +28,11 @@ struct MyExtractor {
struct OtherExtractor;
#[async_trait]
impl<S> FromRequestParts<S> for OtherExtractor
where
S: Send + Sync,
{
impl<S> FromRequestParts<S> for OtherExtractor {
// this rejection doesn't implement `Display` and `Error`
type Rejection = (StatusCode, String);
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> {
todo!()
}
}