Updated docs regarding constraints of Handler arguments (#2451)

This commit is contained in:
Hydrogen602 2023-12-29 01:48:14 +01:00 committed by GitHub
parent 4f010d9b2d
commit 6c276c3ff0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4,7 +4,9 @@ For a function to be used as a handler it must implement the [`Handler`] trait.
axum provides blanket implementations for functions that:
- Are `async fn`s.
- Take no more than 16 arguments that all implement [`FromRequest`].
- Take no more than 16 arguments that all implement `Send`.
- All except the last argument implement [`FromRequestParts`].
- The last argument implements [`FromRequest`].
- Returns something that implements [`IntoResponse`].
- If a closure is used it must implement `Clone + Send` and be
`'static`.