pub struct InertiaConfig {
pub vite_dev_server: String,
pub entry_point: String,
pub version: String,
pub development: bool,
pub html_template: Option<String>,
pub manifest_path: String,
}Expand description
Configuration for Inertia.js responses.
§Example
use ferro_inertia::InertiaConfig;
// Development configuration (default)
let config = InertiaConfig::default();
// Production configuration
let config = InertiaConfig::new()
.version("1.0.0")
.production();
// Custom Vite dev server
let config = InertiaConfig::new()
.vite_dev_server("http://localhost:3000")
.entry_point("src/app.tsx");Fields§
§vite_dev_server: StringVite dev server URL (e.g., “http://localhost:5173”)
entry_point: StringEntry point for the frontend (e.g., “src/main.tsx”)
version: StringAsset version for cache busting
development: boolWhether we’re in development mode (use Vite dev server)
html_template: Option<String>Custom HTML template (if None, uses default)
manifest_path: StringPath to Vite’s manifest.json for resolving hashed asset filenames
Implementations§
Source§impl InertiaConfig
impl InertiaConfig
Sourcepub fn new() -> InertiaConfig
pub fn new() -> InertiaConfig
Create a new configuration with default values.
Sourcepub fn vite_dev_server(self, url: impl Into<String>) -> InertiaConfig
pub fn vite_dev_server(self, url: impl Into<String>) -> InertiaConfig
Set the Vite dev server URL.
Sourcepub fn entry_point(self, entry: impl Into<String>) -> InertiaConfig
pub fn entry_point(self, entry: impl Into<String>) -> InertiaConfig
Set the frontend entry point.
Sourcepub fn version(self, version: impl Into<String>) -> InertiaConfig
pub fn version(self, version: impl Into<String>) -> InertiaConfig
Set the asset version for cache busting.
Sourcepub fn production(self) -> InertiaConfig
pub fn production(self) -> InertiaConfig
Enable production mode (disables Vite dev server integration).
Sourcepub fn development(self) -> InertiaConfig
pub fn development(self) -> InertiaConfig
Enable development mode (enables Vite dev server integration).
Sourcepub fn manifest_path(self, path: impl Into<String>) -> InertiaConfig
pub fn manifest_path(self, path: impl Into<String>) -> InertiaConfig
Set the path to Vite’s manifest.json.
Sourcepub fn html_template(self, template: impl Into<String>) -> InertiaConfig
pub fn html_template(self, template: impl Into<String>) -> InertiaConfig
Set a custom HTML template.
The template should contain the following placeholders:
{page}- The escaped JSON page data{csrf}- The CSRF token (optional)
§Example
use ferro_inertia::InertiaConfig;
let template = r#"
<!DOCTYPE html>
<html>
<head><title>My App</title></head>
<body>
<div id="app" data-page="{page}"></div>
<script src="/app.js"></script>
</body>
</html>
"#;
let config = InertiaConfig::new()
.html_template(template);Trait Implementations§
Source§impl Clone for InertiaConfig
impl Clone for InertiaConfig
Source§fn clone(&self) -> InertiaConfig
fn clone(&self) -> InertiaConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for InertiaConfig
impl Debug for InertiaConfig
Source§impl Default for InertiaConfig
impl Default for InertiaConfig
Source§fn default() -> InertiaConfig
fn default() -> InertiaConfig
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for InertiaConfig
impl RefUnwindSafe for InertiaConfig
impl Send for InertiaConfig
impl Sync for InertiaConfig
impl Unpin for InertiaConfig
impl UnsafeUnpin for InertiaConfig
impl UnwindSafe for InertiaConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more