mirror of https://github.com/fafhrd91/actix-web
fix docs
This commit is contained in:
parent
c0a09f0ebd
commit
0ee42c2346
|
@ -11,17 +11,15 @@ use crate::{
|
||||||
///
|
///
|
||||||
/// # What Is A Request Handler
|
/// # What Is A Request Handler
|
||||||
/// A request handler has three requirements:
|
/// A request handler has three requirements:
|
||||||
/// 1. It is an async function (or a function/closure that returns an appropriate future)
|
/// 1. It is an async function (or a function/closure that returns an appropriate future);
|
||||||
/// and has no more than 12 paramters;
|
/// 1. The function parameters (up to 12) implement [`FromRequest`];
|
||||||
/// 2. The function parameters implement [`FromRequest`];
|
/// 1. The async function (or future) resolves to a type that can be converted into an
|
||||||
/// 3. The async function (or future) resolves to a type that can be converted into an
|
|
||||||
/// [`HttpResponse`] (i.e., it implements the [`Responder`] trait).
|
/// [`HttpResponse`] (i.e., it implements the [`Responder`] trait).
|
||||||
///
|
///
|
||||||
/// # Compiler Errors
|
/// # Compiler Errors
|
||||||
/// If you get the error `the trait Handler<_> is not implemented`, then your handler does not
|
/// If you get the error `the trait Handler<_> is not implemented`, then your handler does not
|
||||||
/// fulfill the _first_ of the above requirements.
|
/// fulfill the _first_ of the above requirements. Missing other requirements manifest as errors on
|
||||||
/// Missing other requirements manifest as errors on implementing [`FromRequest`] and [`Responder`]
|
/// implementing [`FromRequest`] and [`Responder`], respectively.
|
||||||
/// , respectively.
|
|
||||||
///
|
///
|
||||||
/// # How Do Handlers Receive Variable Numbers Of Arguments
|
/// # How Do Handlers Receive Variable Numbers Of Arguments
|
||||||
/// Rest assured there is no macro magic here; it's just traits.
|
/// Rest assured there is no macro magic here; it's just traits.
|
||||||
|
@ -156,21 +154,13 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn arg_number() {
|
fn arg_number() {
|
||||||
async fn handler_min() {}
|
async fn handler_min() {}
|
||||||
|
|
||||||
|
#[rustfmt::skip]
|
||||||
|
#[allow(clippy::too_many_arguments, clippy::just_underscores_and_digits)]
|
||||||
async fn handler_max(
|
async fn handler_max(
|
||||||
_01: (),
|
_01: (), _02: (), _03: (), _04: (), _05: (), _06: (),
|
||||||
_02: (),
|
_07: (), _08: (), _09: (), _10: (), _11: (), _12: (),
|
||||||
_03: (),
|
) {}
|
||||||
_04: (),
|
|
||||||
_05: (),
|
|
||||||
_06: (),
|
|
||||||
_07: (),
|
|
||||||
_08: (),
|
|
||||||
_09: (),
|
|
||||||
_10: (),
|
|
||||||
_11: (),
|
|
||||||
_12: (),
|
|
||||||
) {
|
|
||||||
}
|
|
||||||
|
|
||||||
assert_impl_handler(handler_min);
|
assert_impl_handler(handler_min);
|
||||||
assert_impl_handler(handler_max);
|
assert_impl_handler(handler_max);
|
||||||
|
|
Loading…
Reference in New Issue