Expand description
A small Rust adapter for the Inertia.js protocol.
The crate exposes framework-neutral protocol types plus framework
integrations behind feature flags. The rocket feature is enabled by
default and provides a Rocket
Responder
implementation plus asset-versioning support.
§Example
use inertia_rs::Inertia;
#[derive(serde::Serialize)]
struct Props {
name: String,
}
let response = Inertia::response("Users/Show", Props { name: "Ada".into() });
assert_eq!(response.component(), "Users/Show");Modules§
- axum
- Axum integration for Inertia responses and asset version checks.
Axum integration for
inertia_rs. - headers
- Inertia protocol header constants.
- rocket
- Rocket integration for Inertia responses and asset version checks.
Rocket integration for
inertia_rs.
Structs§
- Html
Response Context - Context passed to framework HTML response renderers.
- Inertia
- A framework-neutral Inertia page response.
- Inertia
Page Builder - Builder for the advanced
Inertia::page(...).props(...)API. - Location
- A server-initiated external location visit.
- Once
Prop - Metadata for a prop that should only be resolved once.
- Page
- A serializable Inertia page object.
- Page
Metadata - Additional Inertia v3 page-object metadata.
- Redirect
- A method-aware redirect response.
- Request
Context - Parsed Inertia request headers.
- Scoped
Inertia Props - Lifetime-aware route-local props with synchronous lazy evaluation.
- Scroll
Props - Infinite-scroll metadata for one page prop.
Constants§
- ACCEPT
- Request header containing accepted response content types.
- CACHE_
CONTROL - Request header set to
no-cachefor Inertia reload requests. - PURPOSE
- Request header set to
prefetchfor Inertia prefetch requests. - VARY
- Response header used to separate HTML and JSON variants in caches.
- X_
INERTIA - Request and response header used to mark Inertia protocol requests.
- X_
INERTIA_ ERROR_ BAG - Request header identifying a validation error bag.
- X_
INERTIA_ EXCEPT_ ONCE_ PROPS - Request header listing once-prop keys the client already has.
- X_
INERTIA_ INFINITE_ SCROLL_ MERGE_ INTENT - Request header used by Inertia’s infinite scroll protocol.
- X_
INERTIA_ LOCATION - Response header used with
409 Conflictto force a full-page visit. - X_
INERTIA_ PARTIAL_ COMPONENT - Request header containing the component targeted by a partial reload.
- X_
INERTIA_ PARTIAL_ DATA - Request header listing props to include in a partial reload.
- X_
INERTIA_ PARTIAL_ EXCEPT - Request header listing props to exclude from a partial reload.
- X_
INERTIA_ REDIRECT - Response header used with fragment redirects.
- X_
INERTIA_ RESET - Request header listing props to reset on navigation.
- X_
INERTIA_ VERSION - Request header containing the client’s current asset version.
- X_
REQUESTED_ WITH - Request header set by Inertia XHR visits.
Traits§
- Into
Page Props - Converts a value into a filtered Inertia props object.
Type Aliases§
- Inertia
Props - Route-local props with synchronous lazy evaluation.