1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-08-19 04:15:38 +02:00

app data doc improvements

This commit is contained in:
Rob Ede
2021-06-24 15:10:51 +01:00
parent 083ee05d50
commit 2d8d2f5ab0
8 changed files with 181 additions and 137 deletions

View File

@@ -144,7 +144,9 @@ where
}
}
/// Service that takes a [`Request`] and delegates to a service that take a [`ServiceRequest`].
/// The [`Service`] that is passed to `actix-http`'s server builder.
///
/// Wraps a service receiving a [`ServiceRequest`] into one receiving a [`Request`].
pub struct AppInitService<T, B>
where
T: Service<ServiceRequest, Response = ServiceResponse<B>, Error = Error>,
@@ -275,6 +277,7 @@ impl ServiceFactory<ServiceRequest> for AppRoutingFactory {
}
}
/// The Actix Web router default entry point.
pub struct AppRouting {
router: Router<HttpService, Guards>,
default: HttpService,
@@ -299,6 +302,10 @@ impl Service<ServiceRequest> for AppRouting {
true
});
// you might expect to find `req.add_data_container()` called here but `HttpRequest` objects
// are created with the root data already set (in `AppInitService::call`) and root data is
// retained when releasing requests back to the pool
if let Some((srv, _info)) = res {
srv.call(req)
} else {