axum-syntax-custom-extractors
Installation
SKILL.md
axum-syntax-custom-extractors
Overview
A custom extractor is a type you define that builds itself from an incoming request. You turn a type into an extractor by implementing one of two traits. Which trait is decided by exactly one question: does the extractor read the request body?
FromRequestParts<S>: builds the value from request parts only (method, URI, headers, extensions, captured path params). It NEVER touches the body and may appear in any handler argument position.FromRequest<S>: builds the value by consuming the request body. A handler may have at most oneFromRequestextractor and it MUST be the last argument.
Both traits carry a Rejection associated type: the error returned when
extraction fails. Rejection MUST implement IntoResponse so Axum converts a
failed extraction directly into an HTTP response.