# Extension points — tokio-rs/axum

> Canonical page: https://codevetter.com/unpack/axum/extension-points

# Extension points — tokio-rs/axum

Scanned commit f8b02f22cf10bee707bda19b58265b9e33677535 (2026-09-30). Generated by codevetter codevetter 1.15.0 on 2026-10-02.

Source inspection; upstream code and tests were not executed.

Extensions are expressed through Rust traits, router builders, Cargo features, and generated implementations. Applications can add typed request inputs and outputs without changing the router internals. Tower services and layers supply middleware composition, while Listener and Executor customize serving within the Tokio/Hyper architecture. axum-extra and axum-macros provide additional integration points for typed routes, cookies, and generated extraction.
- Implement FromRequestParts<S> for metadata-only inputs or FromRequest<S> for body-consuming inputs; both define an IntoResponse rejection and receive application state. — [axum-core/src/extract/mod.rs#L41-L90](https://github.com/tokio-rs/axum/blob/f8b02f22cf10bee707bda19b58265b9e33677535/axum-core/src/extract/mod.rs#L41-L90)
- Implement IntoResponse for domain outputs and errors; its Result implementation converts either branch, allowing application errors to remain HTTP responses rather than Tower service failures. — [axum-core/src/response/into_response.rs#L115-L150](https://github.com/tokio-rs/axum/blob/f8b02f22cf10bee707bda19b58265b9e33677535/axum-core/src/response/into_response.rs#L115-L150) [axum/src/docs/error_handling.md#L25-L46](https://github.com/tokio-rs/axum/blob/f8b02f22cf10bee707bda19b58265b9e33677535/axum/src/docs/error_handling.md#L25-L46)
- Router::route_service accepts cloneable infallible Tower services with IntoResponse outputs, while PathRouter merges method registrations at the same path. — [axum/src/routing/mod.rs#L191-L207](https://github.com/tokio-rs/axum/blob/f8b02f22cf10bee707bda19b58265b9e33677535/axum/src/routing/mod.rs#L191-L207) [axum/src/routing/path_router.rs#L35-L59](https://github.com/tokio-rs/axum/blob/f8b02f22cf10bee707bda19b58265b9e33677535/axum/src/routing/path_router.rs#L35-L59)
- Tower Layer can wrap individual handlers through Handler::layer; from_fn middleware receives a Next continuation that executes the remaining service stack. — [axum/src/handler/mod.rs#L189-L203](https://github.com/tokio-rs/axum/blob/f8b02f22cf10bee707bda19b58265b9e33677535/axum/src/handler/mod.rs#L189-L203) [axum/src/middleware/from_fn.rs#L306-L309](https://github.com/tokio-rs/axum/blob/f8b02f22cf10bee707bda19b58265b9e33677535/axum/src/middleware/from_fn.rs#L306-L309) [axum/src/middleware/from_fn.rs#L336-L349](https://github.com/tokio-rs/axum/blob/f8b02f22cf10bee707bda19b58265b9e33677535/axum/src/middleware/from_fn.rs#L336-L349)
- FromRef connects aggregate application state to substates; the OAuth example independently extracts MemoryStore and BasicClient from AppState, and axum-macros exposes a FromRef derive. — [axum/src/extract/state.rs#L303-L315](https://github.com/tokio-rs/axum/blob/f8b02f22cf10bee707bda19b58265b9e33677535/axum/src/extract/state.rs#L303-L315) [examples/oauth/src/main.rs#L83-L98](https://github.com/tokio-rs/axum/blob/f8b02f22cf10bee707bda19b58265b9e33677535/examples/oauth/src/main.rs#L83-L98) [axum-macros/src/lib.rs#L712-L715](https://github.com/tokio-rs/axum/blob/f8b02f22cf10bee707bda19b58265b9e33677535/axum-macros/src/lib.rs#L712-L715)
- TypedPath links a handler's first argument to a route, derives capture-compatible extraction and percent-encoded Display output, and supports custom rejections; vpath! separately validates static path syntax at compile time. — [axum-extra/src/routing/typed.rs#L22-L44](https://github.com/tokio-rs/axum/blob/f8b02f22cf10bee707bda19b58265b9e33677535/axum-extra/src/routing/typed.rs#L22-L44) [axum-extra/src/routing/typed.rs#L84-L95](https://github.com/tokio-rs/axum/blob/f8b02f22cf10bee707bda19b58265b9e33677535/axum-extra/src/routing/typed.rs#L84-L95) [axum-extra/src/routing/typed.rs#L124-L150](https://github.com/tokio-rs/axum/blob/f8b02f22cf10bee707bda19b58265b9e33677535/axum-extra/src/routing/typed.rs#L124-L150) [axum-extra/src/routing/mod.rs#L28-L53](https://github.com/tokio-rs/axum/blob/f8b02f22cf10bee707bda19b58265b9e33677535/axum-extra/src/routing/mod.rs#L28-L53)
- Custom Listener implementations choose IO/address types and own accept-error retry behavior; ListenerExt adds connection limits, while Serve::with_executor substitutes an Executor returning Tokio JoinHandles. — [axum/src/serve/listener.rs#L15-L30](https://github.com/tokio-rs/axum/blob/f8b02f22cf10bee707bda19b58265b9e33677535/axum/src/serve/listener.rs#L15-L30) [axum/src/serve/listener.rs#L73-L90](https://github.com/tokio-rs/axum/blob/f8b02f22cf10bee707bda19b58265b9e33677535/axum/src/serve/listener.rs#L73-L90) [axum/src/serve/mod.rs#L345-L366](https://github.com/tokio-rs/axum/blob/f8b02f22cf10bee707bda19b58265b9e33677535/axum/src/serve/mod.rs#L345-L366) [axum/src/serve/mod.rs#L499-L509](https://github.com/tokio-rs/axum/blob/f8b02f22cf10bee707bda19b58265b9e33677535/axum/src/serve/mod.rs#L499-L509)
- FromRequest derives accept container-level via, rejection, and state attributes; expansion chooses explicit state or infers it from fields and delegation, providing a generated-wrapper extension path. — [axum-macros/src/from_request/mod.rs#L93-L135](https://github.com/tokio-rs/axum/blob/f8b02f22cf10bee707bda19b58265b9e33677535/axum-macros/src/from_request/mod.rs#L93-L135) [examples/error-handling/src/main.rs#L136-L149](https://github.com/tokio-rs/axum/blob/f8b02f22cf10bee707bda19b58265b9e33677535/examples/error-handling/src/main.rs#L136-L149)

Every claim links to its cited files at the pinned commit. Citations identify source evidence; they do not establish runtime correctness. Independent CodeVetter scan — not reviewed by upstream maintainers.

## Public product links

- [CodeVetter](https://codevetter.com/)
- [Download](https://codevetter.com/download)
- [Documentation](https://codevetter.com/docs/)
- [Source](https://github.com/Codevetter/codevetter)
