with one click
axum-knowledge-patch
Axum
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Menu
Axum
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Based on SOC occupation classification
AlmaLinux
Angular
Arch Linux
Astro
Auth.js
AWS SDK
| name | axum-knowledge-patch |
| description | Axum |
| license | MIT |
| version | 0.8.0 |
| metadata | {"author":"Nevaberry"} |
Baseline: Axum through 0.7.x. Covered range: 0.8-guide and 0.8.0, plus the included axum-core, axum-extra, and axum-macros companion-crate batches.
| Reference | Topics |
|---|---|
| routing-and-serving.md | Handler and service bounds, path arity, generic listeners, static and typed routing, trailing-slash redirects |
| extractors-and-request-bodies.md | Native async extractors, optional extraction, validation errors, strict JSON, body limits, multipart, typed headers, Host and Scheme |
| websockets-and-streaming.md | WebSocket payloads and closure, HTTP/2 routing, subprotocols, fused streams, SSE |
| responses-and-middleware.md | Response status parts, unknown-size bodies, redirects, body normalization, content disposition, tracing |
| dependency-and-release-compatibility.md | Rust version requirements, yanked releases, axum-extra feature flags, prost compatibility, axum-macros fix |
Cargo.lock and feature selections before changing code; companion-crate behavior differs by patch release and several APIs are unreleased.#[async_trait] from custom extractorsAxum 0.8 uses return-position impl Trait in FromRequestParts and FromRequest. Implement their methods with native async fn; do not retain the old #[async_trait] annotation.
SyncAnything added to Router or MethodRouter must now satisfy Sync. Audit:
Replace non-thread-safe captures or wrap state in an appropriately thread-safe representation.
Path<(A, B)> and tuple-struct targets reject a route match unless the number of captured parameters is exact. Do not depend on extra captures being ignored. Align the route pattern and extractor target, or use a named struct that represents every capture.
Option<T> no longer converts every T rejection to None. T must implement OptionalFromRequestParts or OptionalFromRequest so true absence can become None while invalid input or operational failures remain error responses.
Do not use Option<Query<T>>: Query does not implement OptionalFromRequestParts. Later 0.8 releases support optional Json, Extension, and Multipart extraction.
Host usage carefullyAxum 0.8 moves Host from axum::extract to axum_extra::extract::Host. Axum-extra 0.12.4 then deprecates Host and Scheme, and its unreleased line removes both. Also account for these details:
Host includes the port;HostRejection and FailedToResolveHost; andOptionalPath is removed in that unreleased line as well.axum::serve is generic over listener and IO types. Serve::tcp_nodelay and WithGracefulShutdown::tcp_nodelay no longer exist; apply TCP and stream settings through axum::serve::ListenerExt.
Message now uses Bytes instead of Vec<u8> and Utf8Bytes instead of String. Convert owned values where needed:
socket.send(Message::Text("hello".into())).await?;
WebSocket::close is removed. Close explicitly:
socket.send(Message::Close(None)).await?;
For HTTP/2 WebSockets, route with a method-agnostic handler so the HTTP/2 connection method is accepted:
Router::new().route("/ws", any(ws_endpoint))
Select the feature for each utility you use: cached, handler, middleware, optional-path, routing, or with-rejection. The accidental async-stream feature is gone. Since 0.12.3, typed-routing also enables routing.
The axum-extra multipart feature is no longer enabled by default. Enable it explicitly when using axum_extra::extract::Multipart.
As of axum-extra 0.12.6, vpath! rejects :var and *var syntax at compile time. Use braces:
vpath!("/users/{user_id}")
Axum-extra 0.12 option_layer maps the wrapped service response body to axum::body::Body. Remove constraints that require another concrete response-body type after that layer.
Query and Form use serde_path_to_error, so rejections can identify the failing field path. Path extraction can return ErrorKind::DeserializeError with the named parameter's key, value, and deserializer message. Include that variant in exhaustive matching and use its context in diagnostics.
The Json extractor now rejects trailing content after a valid JSON document. Send exactly one document per request body.
Use DefaultBodyLimit::apply inside a custom extractor when it must change the default limit; this has been available since axum-core 0.5.3.
Axum-extra's JsonLines observes the default body limit as of 0.12.5. Its multipart extractor enforces field exclusivity at runtime and, as of 0.12.6, reports body-limit overflow with a specific error.
Use TypedHeaderRejection::is_missing or TypedHeaderRejectionReason::is_missing to distinguish an absent header from a malformed one.
Use WebSocketUpgrade::requested_protocols to inspect client offers, set_selected_protocol to choose one dynamically, and selected_protocol to read the result. WebSocket also implements FusedStream for consumers that need termination-aware stream behavior.
SSE events accept arbitrary binary payload data. The sse module and Sse type no longer require axum's tokio feature, which permits default-features = false configurations without enabling that feature solely for SSE.
Use RouterExt::typed_connect for typed CONNECT routes and TypedPath::with_query_params to construct typed paths with query parameters. Typed paths support custom rejection types, including WithRejection<TypedPath, _>.
In the unreleased axum-extra API, route_with_tsr installs redirects only for methods present on its MethodRouter, so separate method routers can share a path without duplicate method-independent redirects.
The unreleased axum-core API exposes ResponseParts::status and status_mut to IntoResponseParts implementations:
*response_parts.status_mut() = StatusCode::CREATED;
The unreleased Body::unknown() represents a body with unknown size, including useful HEAD response cases. Converting () into a response, directly or through response parts such as HeaderMap and Extensions, now yields an unknown-size body.
An invalid header value passed to a Redirect constructor does not panic immediately. Its IntoResponse conversion produces HTTP 500.
Since axum-extra 0.12.3, ErasedJson::pretty appends a newline. Update exact-body assertions and byte-preserving consumers.
Axum-extra 0.12.6 escapes backslashes and double quotes in Attachment and FileStream filenames. Its unreleased multipart implementation also escapes Content-Disposition parameters and rejects newlines in field names and filenames.
Protobuf integrations and generated message types with prost 0.14.TypedPath derivation when OptionalFromRequestParts is imported.tracing feature to log built-in extractor rejections at the axum::rejection=trace target.