mirror of
https://github.com/tokio-rs/axum.git
synced 2024-12-29 15:49:16 +01:00
Clarify middleware::from_fn argument requirements (#2834)
This commit is contained in:
parent
74eac39e06
commit
205371a6b5
1 changed files with 4 additions and 3 deletions
|
@ -19,9 +19,10 @@ use tower_service::Service;
|
||||||
/// `from_fn` requires the function given to
|
/// `from_fn` requires the function given to
|
||||||
///
|
///
|
||||||
/// 1. Be an `async fn`.
|
/// 1. Be an `async fn`.
|
||||||
/// 2. Take one or more [extractors] as the first arguments.
|
/// 2. Take zero or more [`FromRequestParts`] extractors.
|
||||||
/// 3. Take [`Next`](Next) as the final argument.
|
/// 3. Take exactly one [`FromRequest`] extractor as the second to last argument.
|
||||||
/// 4. Return something that implements [`IntoResponse`].
|
/// 4. Take [`Next`](Next) as the last argument.
|
||||||
|
/// 5. Return something that implements [`IntoResponse`].
|
||||||
///
|
///
|
||||||
/// Note that this function doesn't support extracting [`State`]. For that, use [`from_fn_with_state`].
|
/// Note that this function doesn't support extracting [`State`]. For that, use [`from_fn_with_state`].
|
||||||
///
|
///
|
||||||
|
|
Loading…
Reference in a new issue