Skip to main content

Crate inertia_rs

Crate inertia_rs 

Source
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§

HtmlResponseContext
Context passed to framework HTML response renderers.
Inertia
A framework-neutral Inertia page response.
InertiaPageBuilder
Builder for the advanced Inertia::page(...).props(...) API.
Location
A server-initiated external location visit.
OnceProp
Metadata for a prop that should only be resolved once.
Page
A serializable Inertia page object.
PageMetadata
Additional Inertia v3 page-object metadata.
Redirect
A method-aware redirect response.
RequestContext
Parsed Inertia request headers.
ScopedInertiaProps
Lifetime-aware route-local props with synchronous lazy evaluation.
ScrollProps
Infinite-scroll metadata for one page prop.

Constants§

ACCEPT
Request header containing accepted response content types.
CACHE_CONTROL
Request header set to no-cache for Inertia reload requests.
PURPOSE
Request header set to prefetch for 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 Conflict to 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§

IntoPageProps
Converts a value into a filtered Inertia props object.

Type Aliases§

InertiaProps
Route-local props with synchronous lazy evaluation.