1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-11-20 16:41:05 +00:00

Fix common grammar mistakes and add small documentation for AppConfig's Default implementation (#2793)

This commit is contained in:
PeterPierinakos 2022-06-25 14:01:06 +00:00 committed by GitHub
parent de92b3be2e
commit 8dbf7da89f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 16 additions and 6 deletions

View file

@ -60,7 +60,7 @@ where
/// [`HttpRequest::app_data`](crate::HttpRequest::app_data) method at runtime. /// [`HttpRequest::app_data`](crate::HttpRequest::app_data) method at runtime.
/// ///
/// # [`Data<T>`] /// # [`Data<T>`]
/// Any [`Data<T>`] type added here can utilize it's extractor implementation in handlers. /// Any [`Data<T>`] type added here can utilize its extractor implementation in handlers.
/// Types not wrapped in `Data<T>` cannot use this extractor. See [its docs](Data<T>) for more /// Types not wrapped in `Data<T>` cannot use this extractor. See [its docs](Data<T>) for more
/// about its usage and patterns. /// about its usage and patterns.
/// ///

View file

@ -257,7 +257,7 @@ impl ServiceFactory<ServiceRequest> for AppRoutingFactory {
type Future = LocalBoxFuture<'static, Result<Self::Service, Self::InitError>>; type Future = LocalBoxFuture<'static, Result<Self::Service, Self::InitError>>;
fn new_service(&self, _: ()) -> Self::Future { fn new_service(&self, _: ()) -> Self::Future {
// construct all services factory future with it's resource def and guards. // construct all services factory future with its resource def and guards.
let factory_fut = join_all(self.services.iter().map(|(path, factory, guards)| { let factory_fut = join_all(self.services.iter().map(|(path, factory, guards)| {
let path = path.clone(); let path = path.clone();
let guards = guards.borrow_mut().take().unwrap_or_default(); let guards = guards.borrow_mut().take().unwrap_or_default();

View file

@ -153,6 +153,16 @@ impl AppConfig {
} }
impl Default for AppConfig { impl Default for AppConfig {
/// Returns the default AppConfig.
/// Note: The included socket address is "127.0.0.1".
///
/// 127.0.0.1: non-routable meta address that denotes an unknown, invalid or non-applicable target.
/// If you need a service only accessed by itself, use a loopback address.
/// A loopback address for IPv4 is any loopback address that begins with "127".
/// Loopback addresses should be only used to test your application locally.
/// The default configuration provides a loopback address.
///
/// 0.0.0.0: if configured to use this special address, the application will listen to any IP address configured on the machine.
fn default() -> Self { fn default() -> Self {
AppConfig::new( AppConfig::new(
false, false,

View file

@ -254,7 +254,7 @@ impl Guard for AllGuard {
} }
} }
/// Wraps a guard and inverts the outcome of it's `Guard` implementation. /// Wraps a guard and inverts the outcome of its `Guard` implementation.
/// ///
/// # Examples /// # Examples
/// The handler below will be called for any request method apart from `GET`. /// The handler below will be called for any request method apart from `GET`.
@ -459,7 +459,7 @@ impl Guard for HostGuard {
return scheme == req_host_uri_scheme; return scheme == req_host_uri_scheme;
} }
// TODO: is the the correct behavior? // TODO: is this the correct behavior?
// falls through if scheme cannot be determined // falls through if scheme cannot be determined
} }

View file

@ -37,7 +37,7 @@ use crate::{
/// Thanks to Rust's type system, Actix Web can infer the function parameter types. During the /// Thanks to Rust's type system, Actix Web can infer the function parameter types. During the
/// extraction step, the parameter types are described as a tuple type, [`from_request`] is run on /// extraction step, the parameter types are described as a tuple type, [`from_request`] is run on
/// that tuple, and the `Handler::call` implementation for that particular function arity /// that tuple, and the `Handler::call` implementation for that particular function arity
/// destructures the tuple into it's component types and calls your handler function with them. /// destructures the tuple into its component types and calls your handler function with them.
/// ///
/// In pseudo-code the process looks something like this: /// In pseudo-code the process looks something like this:
/// ```ignore /// ```ignore

View file

@ -343,7 +343,7 @@ mod response_fut_impl {
// Future is only implemented for BoxBody payload type because it's the most useful for making // Future is only implemented for BoxBody payload type because it's the most useful for making
// simple handlers without async blocks. Making it generic over all MessageBody types requires a // simple handlers without async blocks. Making it generic over all MessageBody types requires a
// future impl on Response which would cause it's body field to be, undesirably, Option<B>. // future impl on Response which would cause its body field to be, undesirably, Option<B>.
// //
// This impl is not particularly efficient due to the Response construction and should probably // This impl is not particularly efficient due to the Response construction and should probably
// not be invoked if performance is important. Prefer an async fn/block in such cases. // not be invoked if performance is important. Prefer an async fn/block in such cases.