mirror of
https://github.com/actix/actix-web.git
synced 2024-12-21 07:36:43 +00:00
Intradoc links conversion (#1827)
* switching to nightly for intra-doc links * actix-files intra-doc conversion * more specific Result * intradoc conversion complete * rm blank comments and readme doc link fixes * macros and broken links
This commit is contained in:
parent
542db82282
commit
fabc68659b
18 changed files with 35 additions and 42 deletions
|
@ -53,7 +53,7 @@ pub async fn test_server<F: ServiceFactory<TcpStream>>(factory: F) -> TestServer
|
||||||
test_server_with_addr(tcp, factory).await
|
test_server_with_addr(tcp, factory).await
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Start [`test server`](./fn.test_server.html) on a concrete Address
|
/// Start [`test server`](test_server()) on a concrete Address
|
||||||
pub async fn test_server_with_addr<F: ServiceFactory<TcpStream>>(
|
pub async fn test_server_with_addr<F: ServiceFactory<TcpStream>>(
|
||||||
tcp: net::TcpListener,
|
tcp: net::TcpListener,
|
||||||
factory: F,
|
factory: F,
|
||||||
|
|
|
@ -25,7 +25,7 @@ pub use crate::cookie::ParseError as CookieParseError;
|
||||||
use crate::helpers::Writer;
|
use crate::helpers::Writer;
|
||||||
use crate::response::{Response, ResponseBuilder};
|
use crate::response::{Response, ResponseBuilder};
|
||||||
|
|
||||||
/// A specialized [`Result`](https://doc.rust-lang.org/std/result/enum.Result.html)
|
/// A specialized [`std::result::Result`]
|
||||||
/// for actix web operations
|
/// for actix web operations
|
||||||
///
|
///
|
||||||
/// This typedef is generally used to avoid writing out
|
/// This typedef is generally used to avoid writing out
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
//! ## Mime
|
//! ## Mime
|
||||||
//!
|
//!
|
||||||
//! Several header fields use MIME values for their contents. Keeping with the
|
//! Several header fields use MIME values for their contents. Keeping with the
|
||||||
//! strongly-typed theme, the [mime](https://docs.rs/mime) crate
|
//! strongly-typed theme, the [mime] crate
|
||||||
//! is used, such as `ContentType(pub Mime)`.
|
//! is used, such as `ContentType(pub Mime)`.
|
||||||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,6 @@ use http::header::{HeaderName, HeaderValue};
|
||||||
/// A set of HTTP headers
|
/// A set of HTTP headers
|
||||||
///
|
///
|
||||||
/// `HeaderMap` is an multi-map of [`HeaderName`] to values.
|
/// `HeaderMap` is an multi-map of [`HeaderName`] to values.
|
||||||
///
|
|
||||||
/// [`HeaderName`]: struct.HeaderName.html
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct HeaderMap {
|
pub struct HeaderMap {
|
||||||
pub(crate) inner: FxHashMap<HeaderName, Value>,
|
pub(crate) inner: FxHashMap<HeaderName, Value>,
|
||||||
|
@ -141,8 +139,6 @@ impl HeaderMap {
|
||||||
/// The returned view does not incur any allocations and allows iterating
|
/// The returned view does not incur any allocations and allows iterating
|
||||||
/// the values associated with the key. See [`GetAll`] for more details.
|
/// the values associated with the key. See [`GetAll`] for more details.
|
||||||
/// Returns `None` if there are no values associated with the key.
|
/// Returns `None` if there are no values associated with the key.
|
||||||
///
|
|
||||||
/// [`GetAll`]: struct.GetAll.html
|
|
||||||
pub fn get_all<N: AsName>(&self, name: N) -> GetAll<'_> {
|
pub fn get_all<N: AsName>(&self, name: N) -> GetAll<'_> {
|
||||||
GetAll {
|
GetAll {
|
||||||
idx: 0,
|
idx: 0,
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
> Helper and convenience macros for Actix Web
|
> Helper and convenience macros for Actix Web
|
||||||
|
|
||||||
[![crates.io](https://meritbadge.herokuapp.com/actix-web-codegen)](https://crates.io/crates/actix-web-codegen)
|
[![crates.io](https://meritbadge.herokuapp.com/actix-web-codegen)](https://crates.io/crates/actix-web-codegen)
|
||||||
[![Documentation](https://docs.rs/actix-web-codegen/badge.svg)](https://docs.rs/actix-web)
|
[![Documentation](https://docs.rs/actix-web-codegen/badge.svg)](https://docs.rs/actix-web-codegen/0.4.0/actix_web_codegen/)
|
||||||
[![Version](https://img.shields.io/badge/rustc-1.42+-ab6000.svg)](https://blog.rust-lang.org/2020/03/12/Rust-1.42.html)
|
[![Version](https://img.shields.io/badge/rustc-1.42+-ab6000.svg)](https://blog.rust-lang.org/2020/03/12/Rust-1.42.html)
|
||||||
[![Build Status](https://travis-ci.org/actix/actix-web.svg?branch=master)](https://travis-ci.org/actix/actix-web)
|
[![Build Status](https://travis-ci.org/actix/actix-web.svg?branch=master)](https://travis-ci.org/actix/actix-web)
|
||||||
[![codecov](https://codecov.io/gh/actix/actix-web/branch/master/graph/badge.svg)](https://codecov.io/gh/actix/actix-web)
|
[![codecov](https://codecov.io/gh/actix/actix-web/branch/master/graph/badge.svg)](https://codecov.io/gh/actix/actix-web)
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
//! are re-exported.
|
//! are re-exported.
|
||||||
//!
|
//!
|
||||||
//! # Runtime Setup
|
//! # Runtime Setup
|
||||||
//! Used for setting up the actix async runtime. See [main] macro docs.
|
//! Used for setting up the actix async runtime. See [macro@main] macro docs.
|
||||||
//!
|
//!
|
||||||
//! ```rust
|
//! ```rust
|
||||||
//! #[actix_web_codegen::main] // or `#[actix_web::main]` in Actix Web apps
|
//! #[actix_web_codegen::main] // or `#[actix_web::main]` in Actix Web apps
|
||||||
|
@ -34,7 +34,7 @@
|
||||||
//!
|
//!
|
||||||
//! # Multiple Method Handlers
|
//! # Multiple Method Handlers
|
||||||
//! Similar to the single method handler macro but takes one or more arguments for the HTTP methods
|
//! Similar to the single method handler macro but takes one or more arguments for the HTTP methods
|
||||||
//! it should respond to. See [route] macro docs.
|
//! it should respond to. See [macro@route] macro docs.
|
||||||
//!
|
//!
|
||||||
//! ```rust
|
//! ```rust
|
||||||
//! # use actix_web::HttpResponse;
|
//! # use actix_web::HttpResponse;
|
||||||
|
@ -46,17 +46,15 @@
|
||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
//! [actix-web attributes docs]: https://docs.rs/actix-web/*/actix_web/#attributes
|
//! [actix-web attributes docs]: https://docs.rs/actix-web/*/actix_web/#attributes
|
||||||
//! [main]: attr.main.html
|
//! [GET]: macro@get
|
||||||
//! [route]: attr.route.html
|
//! [POST]: macro@post
|
||||||
//! [GET]: attr.get.html
|
//! [PUT]: macro@put
|
||||||
//! [POST]: attr.post.html
|
//! [HEAD]: macro@head
|
||||||
//! [PUT]: attr.put.html
|
//! [CONNECT]: macro@macro@connect
|
||||||
//! [DELETE]: attr.delete.html
|
//! [OPTIONS]: macro@options
|
||||||
//! [HEAD]: attr.head.html
|
//! [TRACE]: macro@trace
|
||||||
//! [CONNECT]: attr.connect.html
|
//! [PATCH]: macro@patch
|
||||||
//! [OPTIONS]: attr.options.html
|
//! [DELETE]: macro@delete
|
||||||
//! [TRACE]: attr.trace.html
|
|
||||||
//! [PATCH]: attr.patch.html
|
|
||||||
|
|
||||||
#![recursion_limit = "512"]
|
#![recursion_limit = "512"]
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
//! Websockets client
|
//! Websockets client
|
||||||
//!
|
//!
|
||||||
//! Type definitions required to use [`awc::Client`](../struct.Client.html) as a WebSocket client.
|
//! Type definitions required to use [`awc::Client`](super::Client) as a WebSocket client.
|
||||||
//!
|
//!
|
||||||
//! # Example
|
//! # Example
|
||||||
//!
|
//!
|
||||||
|
|
|
@ -141,7 +141,7 @@ impl AppConfig {
|
||||||
/// Server host name.
|
/// Server host name.
|
||||||
///
|
///
|
||||||
/// Host name is used by application router as a hostname for url generation.
|
/// Host name is used by application router as a hostname for url generation.
|
||||||
/// Check [ConnectionInfo](./struct.ConnectionInfo.html#method.host)
|
/// Check [ConnectionInfo](super::dev::ConnectionInfo::host())
|
||||||
/// documentation for more information.
|
/// documentation for more information.
|
||||||
///
|
///
|
||||||
/// By default host name is set to a "localhost" value.
|
/// By default host name is set to a "localhost" value.
|
||||||
|
|
|
@ -174,7 +174,7 @@ impl ConnectionInfo {
|
||||||
/// Do not use this function for security purposes, unless you can ensure the Forwarded and
|
/// Do not use this function for security purposes, unless you can ensure the Forwarded and
|
||||||
/// X-Forwarded-For headers cannot be spoofed by the client. If you want the client's socket
|
/// X-Forwarded-For headers cannot be spoofed by the client. If you want the client's socket
|
||||||
/// address explicitly, use
|
/// address explicitly, use
|
||||||
/// [`HttpRequest::peer_addr()`](../web/struct.HttpRequest.html#method.peer_addr) instead.
|
/// [`HttpRequest::peer_addr()`](super::web::HttpRequest::peer_addr()) instead.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn realip_remote_addr(&self) -> Option<&str> {
|
pub fn realip_remote_addr(&self) -> Option<&str> {
|
||||||
if let Some(ref r) = self.realip_remote_addr {
|
if let Some(ref r) = self.realip_remote_addr {
|
||||||
|
|
|
@ -29,16 +29,16 @@
|
||||||
//!
|
//!
|
||||||
//! To get started navigating the API docs, you may consider looking at the following pages first:
|
//! To get started navigating the API docs, you may consider looking at the following pages first:
|
||||||
//!
|
//!
|
||||||
//! * [App](struct.App.html): This struct represents an Actix web application and is used to
|
//! * [App]: This struct represents an Actix web application and is used to
|
||||||
//! configure routes and other common application settings.
|
//! configure routes and other common application settings.
|
||||||
//!
|
//!
|
||||||
//! * [HttpServer](struct.HttpServer.html): This struct represents an HTTP server instance and is
|
//! * [HttpServer]: This struct represents an HTTP server instance and is
|
||||||
//! used to instantiate and configure servers.
|
//! used to instantiate and configure servers.
|
||||||
//!
|
//!
|
||||||
//! * [web](web/index.html): This module provides essential types for route registration as well as
|
//! * [web]: This module provides essential types for route registration as well as
|
||||||
//! common utilities for request handlers.
|
//! common utilities for request handlers.
|
||||||
//!
|
//!
|
||||||
//! * [HttpRequest](struct.HttpRequest.html) and [HttpResponse](struct.HttpResponse.html): These
|
//! * [HttpRequest] and [HttpResponse]: These
|
||||||
//! structs represent HTTP requests and responses and expose methods for creating, inspecting,
|
//! structs represent HTTP requests and responses and expose methods for creating, inspecting,
|
||||||
//! and otherwise utilizing them.
|
//! and otherwise utilizing them.
|
||||||
//!
|
//!
|
||||||
|
|
|
@ -82,11 +82,10 @@ use crate::HttpResponse;
|
||||||
///
|
///
|
||||||
/// # Security
|
/// # Security
|
||||||
/// **\*** It is calculated using
|
/// **\*** It is calculated using
|
||||||
/// [`ConnectionInfo::realip_remote_addr()`](../dev/struct.ConnectionInfo.html#method.realip_remote_addr)
|
/// [`ConnectionInfo::realip_remote_addr()`](crate::dev::ConnectionInfo::realip_remote_addr())
|
||||||
///
|
///
|
||||||
/// If you use this value ensure that all requests come from trusted hosts, since it is trivial
|
/// If you use this value ensure that all requests come from trusted hosts, since it is trivial
|
||||||
/// for the remote client to simulate being another client.
|
/// for the remote client to simulate being another client.
|
||||||
///
|
|
||||||
pub struct Logger(Rc<Inner>);
|
pub struct Logger(Rc<Inner>);
|
||||||
|
|
||||||
struct Inner {
|
struct Inner {
|
||||||
|
|
|
@ -213,7 +213,7 @@ where
|
||||||
/// Set server host name.
|
/// Set server host name.
|
||||||
///
|
///
|
||||||
/// Host name is used by application router as a hostname for url generation.
|
/// Host name is used by application router as a hostname for url generation.
|
||||||
/// Check [ConnectionInfo](./dev/struct.ConnectionInfo.html#method.host)
|
/// Check [ConnectionInfo](super::dev::ConnectionInfo::host())
|
||||||
/// documentation for more information.
|
/// documentation for more information.
|
||||||
///
|
///
|
||||||
/// By default host name is set to a "localhost" value.
|
/// By default host name is set to a "localhost" value.
|
||||||
|
|
|
@ -195,13 +195,13 @@ impl ServiceRequest {
|
||||||
self.0.match_info()
|
self.0.match_info()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Counterpart to [`HttpRequest::match_name`](../struct.HttpRequest.html#method.match_name).
|
/// Counterpart to [`HttpRequest::match_name`](super::HttpRequest::match_name()).
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn match_name(&self) -> Option<&str> {
|
pub fn match_name(&self) -> Option<&str> {
|
||||||
self.0.match_name()
|
self.0.match_name()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Counterpart to [`HttpRequest::match_pattern`](../struct.HttpRequest.html#method.match_pattern).
|
/// Counterpart to [`HttpRequest::match_pattern`](super::HttpRequest::match_pattern()).
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn match_pattern(&self) -> Option<String> {
|
pub fn match_pattern(&self) -> Option<String> {
|
||||||
self.0.match_pattern()
|
self.0.match_pattern()
|
||||||
|
@ -225,7 +225,7 @@ impl ServiceRequest {
|
||||||
self.0.app_config()
|
self.0.app_config()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Counterpart to [`HttpRequest::app_data`](../struct.HttpRequest.html#method.app_data).
|
/// Counterpart to [`HttpRequest::app_data`](super::HttpRequest::app_data()).
|
||||||
pub fn app_data<T: 'static>(&self) -> Option<&T> {
|
pub fn app_data<T: 'static>(&self) -> Option<&T> {
|
||||||
for container in (self.0).0.app_data.iter().rev() {
|
for container in (self.0).0.app_data.iter().rev() {
|
||||||
if let Some(data) = container.get::<T>() {
|
if let Some(data) = container.get::<T>() {
|
||||||
|
|
|
@ -35,7 +35,7 @@ use crate::{responder::Responder, web};
|
||||||
/// To extract typed information from request's body, the type `T` must
|
/// To extract typed information from request's body, the type `T` must
|
||||||
/// implement the `Deserialize` trait from *serde*.
|
/// implement the `Deserialize` trait from *serde*.
|
||||||
///
|
///
|
||||||
/// [**FormConfig**](struct.FormConfig.html) allows to configure extraction
|
/// [**FormConfig**](FormConfig) allows to configure extraction
|
||||||
/// process.
|
/// process.
|
||||||
///
|
///
|
||||||
/// ### Example
|
/// ### Example
|
||||||
|
|
|
@ -31,7 +31,7 @@ use crate::{responder::Responder, web};
|
||||||
/// To extract typed information from request's body, the type `T` must
|
/// To extract typed information from request's body, the type `T` must
|
||||||
/// implement the `Deserialize` trait from *serde*.
|
/// implement the `Deserialize` trait from *serde*.
|
||||||
///
|
///
|
||||||
/// [**JsonConfig**](struct.JsonConfig.html) allows to configure extraction
|
/// [**JsonConfig**](JsonConfig) allows to configure extraction
|
||||||
/// process.
|
/// process.
|
||||||
///
|
///
|
||||||
/// ## Example
|
/// ## Example
|
||||||
|
@ -142,7 +142,7 @@ impl<T: Serialize> Responder for Json<T> {
|
||||||
/// To extract typed information from request's body, the type `T` must
|
/// To extract typed information from request's body, the type `T` must
|
||||||
/// implement the `Deserialize` trait from *serde*.
|
/// implement the `Deserialize` trait from *serde*.
|
||||||
///
|
///
|
||||||
/// [**JsonConfig**](struct.JsonConfig.html) allows to configure extraction
|
/// [**JsonConfig**](JsonConfig) allows to configure extraction
|
||||||
/// process.
|
/// process.
|
||||||
///
|
///
|
||||||
/// ## Example
|
/// ## Example
|
||||||
|
@ -306,7 +306,7 @@ impl Default for JsonConfig {
|
||||||
/// Returns error:
|
/// Returns error:
|
||||||
///
|
///
|
||||||
/// * content type is not `application/json`
|
/// * content type is not `application/json`
|
||||||
/// (unless specified in [`JsonConfig`](struct.JsonConfig.html))
|
/// (unless specified in [`JsonConfig`])
|
||||||
/// * content length is greater than 256k
|
/// * content length is greater than 256k
|
||||||
pub struct JsonBody<U> {
|
pub struct JsonBody<U> {
|
||||||
limit: usize,
|
limit: usize,
|
||||||
|
|
|
@ -15,7 +15,7 @@ use crate::FromRequest;
|
||||||
#[derive(PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(PartialEq, Eq, PartialOrd, Ord)]
|
||||||
/// Extract typed information from the request's path.
|
/// Extract typed information from the request's path.
|
||||||
///
|
///
|
||||||
/// [**PathConfig**](struct.PathConfig.html) allows to configure extraction process.
|
/// [**PathConfig**](PathConfig) allows to configure extraction process.
|
||||||
///
|
///
|
||||||
/// ## Example
|
/// ## Example
|
||||||
///
|
///
|
||||||
|
|
|
@ -111,7 +111,7 @@ impl FromRequest for Payload {
|
||||||
///
|
///
|
||||||
/// Loads request's payload and construct Bytes instance.
|
/// Loads request's payload and construct Bytes instance.
|
||||||
///
|
///
|
||||||
/// [**PayloadConfig**](struct.PayloadConfig.html) allows to configure
|
/// [**PayloadConfig**](PayloadConfig) allows to configure
|
||||||
/// extraction process.
|
/// extraction process.
|
||||||
///
|
///
|
||||||
/// ## Example
|
/// ## Example
|
||||||
|
@ -159,7 +159,7 @@ impl FromRequest for Bytes {
|
||||||
///
|
///
|
||||||
/// Text extractor automatically decode body according to the request's charset.
|
/// Text extractor automatically decode body according to the request's charset.
|
||||||
///
|
///
|
||||||
/// [**PayloadConfig**](struct.PayloadConfig.html) allows to configure
|
/// [**PayloadConfig**](PayloadConfig) allows to configure
|
||||||
/// extraction process.
|
/// extraction process.
|
||||||
///
|
///
|
||||||
/// ## Example
|
/// ## Example
|
||||||
|
|
|
@ -18,7 +18,7 @@ use crate::request::HttpRequest;
|
||||||
/// be decoded into any type which depends upon data ordering e.g. tuples or tuple-structs.
|
/// be decoded into any type which depends upon data ordering e.g. tuples or tuple-structs.
|
||||||
/// Attempts to do so will *fail at runtime*.
|
/// Attempts to do so will *fail at runtime*.
|
||||||
///
|
///
|
||||||
/// [**QueryConfig**](struct.QueryConfig.html) allows to configure extraction process.
|
/// [**QueryConfig**](QueryConfig) allows to configure extraction process.
|
||||||
///
|
///
|
||||||
/// ## Example
|
/// ## Example
|
||||||
///
|
///
|
||||||
|
|
Loading…
Reference in a new issue