Don't internally Arc the state (#1460)

This commit is contained in:
David Pedersen
2022-10-09 20:55:28 +00:00
committed by GitHub
parent a2ab338e68
commit f9dc96fdce
18 changed files with 206 additions and 185 deletions
+3 -3
View File
@@ -7,7 +7,7 @@ use axum::{
response::{IntoResponse, Response},
};
use futures_util::future::{BoxFuture, Either as EitherFuture, FutureExt, Map};
use std::{future::Future, marker::PhantomData, sync::Arc};
use std::{future::Future, marker::PhantomData};
/// [`Handler`] that runs one [`Handler`] and if that rejects it'll fallback to another
/// [`Handler`].
@@ -37,7 +37,7 @@ where
fn call(
self,
extractors: Either<Lt, Rt>,
state: Arc<S>,
state: S,
) -> <Self as HandlerCallWithExtractors<Either<Lt, Rt>, S, B>>::Future {
match extractors {
Either::E1(lt) => self
@@ -68,7 +68,7 @@ where
// this puts `futures_util` in our public API but thats fine in axum-extra
type Future = BoxFuture<'static, Response>;
fn call(self, req: Request<B>, state: Arc<S>) -> Self::Future {
fn call(self, req: Request<B>, state: S) -> Self::Future {
Box::pin(async move {
let (mut parts, body) = req.into_parts();