Skip to content

Commit

Permalink
minor docs fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
davidpdrsn committed Jun 27, 2022
1 parent c32b19f commit 8f5c055
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
11 changes: 6 additions & 5 deletions axum-core/src/extract/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,17 @@ pub struct Once(Infallible);
///
/// # What is the `R` type parameter?
///
/// `FromRequest`'s `R` type parameter is used to control which parts of the request the extrator
/// `FromRequest`'s `R` type parameter is used to control which parts of the request the extractor
/// has access to.
///
/// `R` is always one of two values:
///
/// - [`Mut`]: This means the extractor has mutable (but limited) access the request. It can access
/// the method, uri, version, headers, and extensions, but it cannot consume the body.
/// - [`Once`]: This includes the same access as [`Mut`] but can als consume the body. This means
/// extractors that use `RequestParts<Once, _>` can only be run once and must run as the last
/// extractor.
/// the method, uri, version, individual headers, and individual extensions. It cannot consume
/// the body, consume all headers, or consume all extensions.
/// - [`Once`]: This includes the same access as [`Mut`] but can also consume the body, consume all
/// headers, and consume all extensions. This means extractors that use `RequestParts<Once, _>` can
/// only be run once and must run as the _last_ extractor.
///
/// axum uses these types to guarantee that you don't accidentally attempt to extract the request
/// body twice or otherwise run extractors in the wrong order.
Expand Down
1 change: 1 addition & 0 deletions axum/src/docs/debugging_handler_type_errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ axum provides blanket implementations for functions that:

- Are `async fn`s.
- Take no more than 16 arguments that all implement [`FromRequest`].
- Only the last argument implements `FromRequest<Once, B>`.
- Returns something that implements [`IntoResponse`].
- If a closure is used it must implement `Clone + Send` and be
`'static`.
Expand Down

0 comments on commit 8f5c055

Please sign in to comment.