Crate ript

Source
Expand description

ript is a crate for implementing a Rusty version of the Inertia.js protocol as a layer on top of Axum. This provides 100% conformity to the inertia protocol and is directly compatible with the inertiajs javascript package, while providing an additional feature set and a more ergonomic API for rust. Additionally, ript implements some things differently from the original Laravel implementation, such as different error handling around validation.

To get started with ript, simply set up an axum server like normal, and then add a response middleware utilizing the crate::driver::driver function.

Then, you can write any handlers you desire using the crate::Inertia extractor.

Re-exports§

pub use axum;

Modules§

providers
Collection of providers for inertia that boost its functionality and allow you to configure inertia for your own server / client’s environment.

Structs§

Inertia
The entrypoint to Inertia that is used by route handlers and response mapping middleware.
RenderResponse
Inertia response when rendering a page.

Functions§

always
This prop should always be sent back, regardless of if the request is partial or if the prop has been asked for. Only use this on data that is very cheap to calculate, or you may run into performance issues depending on how agressively you reload the page.
defer
This prop should be deferred during a full reload, and sent back during a partial reload if it is requested. The defer logic is automatically implemented by the InertiaJS client for you, so if you’re using a deferred prop it will automatically work.
driver
Axum map response function for powering inertia.
infallible
Since all props must be either a Result or an Option, this provides a utility to wrap a non-result type as an infallible Result. This means it will never abort and hit the error handling response middleware, nor will it become nullable
lazy
This prop should only be rendered if explicitly requested in a partial reload.
merge
This prop should be merged with the previous value of the prop set, if it exists. The merging logic itself is completely handled by the InertiaJS client, so all this really does is flag the prop to be merged but it will behave like a regular prop otherwise. This can be combined with other methods at-will.