mirror of
https://github.com/fafhrd91/actix-web
synced 2024-11-23 16:21:06 +01:00
improve docs for app_config methods
This commit is contained in:
parent
42193bee29
commit
358c1cf85b
@ -21,7 +21,7 @@ use crate::{
|
||||
Error, HttpResponse,
|
||||
};
|
||||
|
||||
/// Service factory to convert `Request` to a `ServiceRequest<S>`.
|
||||
/// Service factory to convert [`Request`] to a [`ServiceRequest<S>`].
|
||||
///
|
||||
/// It also executes data factories.
|
||||
pub struct AppInit<T, B>
|
||||
@ -155,7 +155,7 @@ where
|
||||
app_state: Rc<AppInitServiceState>,
|
||||
}
|
||||
|
||||
/// A collection of [`AppInitService`] state that shared across `HttpRequest`s.
|
||||
/// A collection of state for [`AppInitService`] that is shared across [`HttpRequest`]s.
|
||||
pub(crate) struct AppInitServiceState {
|
||||
rmap: Rc<ResourceMap>,
|
||||
config: AppConfig,
|
||||
@ -163,6 +163,7 @@ pub(crate) struct AppInitServiceState {
|
||||
}
|
||||
|
||||
impl AppInitServiceState {
|
||||
/// Constructs state collection from resource map and app config.
|
||||
pub(crate) fn new(rmap: Rc<ResourceMap>, config: AppConfig) -> Rc<Self> {
|
||||
Rc::new(AppInitServiceState {
|
||||
rmap,
|
||||
@ -171,16 +172,19 @@ impl AppInitServiceState {
|
||||
})
|
||||
}
|
||||
|
||||
/// Returns a reference to the application's resource map.
|
||||
#[inline]
|
||||
pub(crate) fn rmap(&self) -> &ResourceMap {
|
||||
&self.rmap
|
||||
}
|
||||
|
||||
/// Returns a reference to the application's configuration.
|
||||
#[inline]
|
||||
pub(crate) fn config(&self) -> &AppConfig {
|
||||
&self.config
|
||||
}
|
||||
|
||||
/// Returns a reference to the application's request pool.
|
||||
#[inline]
|
||||
pub(crate) fn pool(&self) -> &HttpRequestPool {
|
||||
&self.pool
|
||||
|
@ -141,7 +141,7 @@ impl AppConfig {
|
||||
self.secure
|
||||
}
|
||||
|
||||
/// Returns the socket address of the local half of this TCP connection
|
||||
/// Returns the socket address of the local half of this TCP connection.
|
||||
pub fn local_addr(&self) -> SocketAddr {
|
||||
self.addr
|
||||
}
|
||||
|
@ -260,7 +260,7 @@ impl HttpRequest {
|
||||
Ref::map(self.extensions(), |data| data.get().unwrap())
|
||||
}
|
||||
|
||||
/// App config
|
||||
/// Returns a reference to the application's connection configuration.
|
||||
#[inline]
|
||||
pub fn app_config(&self) -> &AppConfig {
|
||||
self.app_state().config()
|
||||
|
@ -238,11 +238,7 @@ impl ServiceRequest {
|
||||
self.req.connection_info()
|
||||
}
|
||||
|
||||
/// Returns reference to the Path parameters.
|
||||
///
|
||||
/// Params is a container for URL parameters. A variable segment is specified in the form
|
||||
/// `{identifier}`, where the identifier can be used later in a request handler to access the
|
||||
/// matched value for that segment.
|
||||
/// Counterpart to [`HttpRequest::match_info`].
|
||||
#[inline]
|
||||
pub fn match_info(&self) -> &Path<Url> {
|
||||
self.req.match_info()
|
||||
@ -267,12 +263,13 @@ impl ServiceRequest {
|
||||
}
|
||||
|
||||
/// Returns a reference to the application's resource map.
|
||||
/// Counterpart to [`HttpRequest::resource_map`].
|
||||
#[inline]
|
||||
pub fn resource_map(&self) -> &ResourceMap {
|
||||
self.req.resource_map()
|
||||
}
|
||||
|
||||
/// Returns a reference to the application's configuration.
|
||||
/// Counterpart to [`HttpRequest::app_config`].
|
||||
#[inline]
|
||||
pub fn app_config(&self) -> &AppConfig {
|
||||
self.req.app_config()
|
||||
|
Loading…
Reference in New Issue
Block a user