Always store state in an Arc (#1270)

* Add extension and state benchmarks

* wip

* Arc the state everywhere

* don't require `S: Clone`

* fix example
This commit is contained in:
David Pedersen
2022-08-17 20:08:24 +00:00
committed by GitHub
parent 423308de3c
commit e7f1c88cd4
56 changed files with 199 additions and 141 deletions
+3 -3
View File
@@ -223,7 +223,7 @@ fn impl_struct_by_extracting_each_field(
B: ::axum::body::HttpBody + ::std::marker::Send + 'static,
B::Data: ::std::marker::Send,
B::Error: ::std::convert::Into<::axum::BoxError>,
S: Send,
S: ::std::marker::Send + ::std::marker::Sync,
{
type Rejection = #rejection_ident;
@@ -659,7 +659,7 @@ fn impl_struct_by_extracting_all_at_once(
#path<#via_type_generics>: ::axum::extract::FromRequest<S, B>,
#rejection_bound
B: ::std::marker::Send,
S: ::std::marker::Send,
S: ::std::marker::Send + ::std::marker::Sync,
{
type Rejection = #associated_rejection_type;
@@ -725,7 +725,7 @@ fn impl_enum_by_extracting_all_at_once(
B: ::axum::body::HttpBody + ::std::marker::Send + 'static,
B::Data: ::std::marker::Send,
B::Error: ::std::convert::Into<::axum::BoxError>,
S: ::std::marker::Send,
S: ::std::marker::Send + ::std::marker::Sync,
{
type Rejection = #associated_rejection_type;
+1 -1
View File
@@ -226,7 +226,7 @@ mod typed_path;
/// impl<S, B> FromRequest<S, B> for OtherExtractor
/// where
/// B: Send,
/// S: Send,
/// S: Send + Sync,
/// {
/// // this rejection doesn't implement `Display` and `Error`
/// type Rejection = (StatusCode, String);
+3 -3
View File
@@ -130,7 +130,7 @@ fn expand_named_fields(
impl<S, B> ::axum::extract::FromRequest<S, B> for #ident
where
B: Send,
S: Send,
S: Send + Sync,
{
type Rejection = #rejection_assoc_type;
@@ -233,7 +233,7 @@ fn expand_unnamed_fields(
impl<S, B> ::axum::extract::FromRequest<S, B> for #ident
where
B: Send,
S: Send,
S: Send + Sync,
{
type Rejection = #rejection_assoc_type;
@@ -315,7 +315,7 @@ fn expand_unit_fields(
impl<S, B> ::axum::extract::FromRequest<S, B> for #ident
where
B: Send,
S: Send,
S: Send + Sync,
{
type Rejection = #rejection_assoc_type;