mirror of
https://github.com/tokio-rs/axum.git
synced 2026-09-08 00:00:24 +02:00
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:
@@ -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;
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ pub struct CookieJar {
|
||||
impl<S, B> FromRequest<S, B> for CookieJar
|
||||
where
|
||||
B: Send,
|
||||
S: Send,
|
||||
S: Send + Sync,
|
||||
{
|
||||
type Rejection = Infallible;
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ impl<K> fmt::Debug for PrivateCookieJar<K> {
|
||||
impl<S, B, K> FromRequest<S, B> for PrivateCookieJar<K>
|
||||
where
|
||||
B: Send,
|
||||
S: Send,
|
||||
S: Send + Sync,
|
||||
K: FromRef<S> + Into<Key>,
|
||||
{
|
||||
type Rejection = Infallible;
|
||||
|
||||
@@ -108,7 +108,7 @@ impl<K> fmt::Debug for SignedCookieJar<K> {
|
||||
impl<S, B, K> FromRequest<S, B> for SignedCookieJar<K>
|
||||
where
|
||||
B: Send,
|
||||
S: Send,
|
||||
S: Send + Sync,
|
||||
K: FromRef<S> + Into<Key>,
|
||||
{
|
||||
type Rejection = Infallible;
|
||||
|
||||
@@ -61,7 +61,7 @@ where
|
||||
B: HttpBody + Send,
|
||||
B::Data: Send,
|
||||
B::Error: Into<BoxError>,
|
||||
S: Send,
|
||||
S: Send + Sync,
|
||||
{
|
||||
type Rejection = FormRejection;
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ impl<T, S, B> FromRequest<S, B> for Query<T>
|
||||
where
|
||||
T: DeserializeOwned,
|
||||
B: Send,
|
||||
S: Send,
|
||||
S: Send + Sync,
|
||||
{
|
||||
type Rejection = QueryRejection;
|
||||
|
||||
|
||||
@@ -110,7 +110,7 @@ impl<E, R> DerefMut for WithRejection<E, R> {
|
||||
impl<B, E, R, S> FromRequest<S, B> for WithRejection<E, R>
|
||||
where
|
||||
B: Send,
|
||||
S: Send,
|
||||
S: Send + Sync,
|
||||
E: FromRequest<S, B>,
|
||||
R: From<E::Rejection> + IntoResponse,
|
||||
{
|
||||
@@ -138,7 +138,7 @@ mod tests {
|
||||
impl<S, B> FromRequest<S, B> for TestExtractor
|
||||
where
|
||||
B: Send,
|
||||
S: Send,
|
||||
S: Send + Sync,
|
||||
{
|
||||
type Rejection = ();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user