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
+4 -4
View File
@@ -33,7 +33,7 @@ use std::ops::{Deref, DerefMut};
/// impl<S, B> FromRequest<S, B> for Session
/// where
/// B: Send,
/// S: Send,
/// S: Send + Sync,
/// {
/// type Rejection = (StatusCode, String);
///
@@ -49,7 +49,7 @@ use std::ops::{Deref, DerefMut};
/// impl<S, B> FromRequest<S, B> for CurrentUser
/// where
/// B: Send,
/// S: Send,
/// S: Send + Sync,
/// {
/// type Rejection = Response;
///
@@ -93,7 +93,7 @@ struct CachedEntry<T>(T);
impl<S, B, T> FromRequest<S, B> for Cached<T>
where
B: Send,
S: Send,
S: Send + Sync,
T: FromRequest<S, B> + Clone + Send + Sync + 'static,
{
type Rejection = T::Rejection;
@@ -145,7 +145,7 @@ mod tests {
impl<S, B> FromRequest<S, B> for Extractor
where
B: Send,
S: Send,
S: Send + Sync,
{
type Rejection = Infallible;