pub struct InertiaConfig {
pub app_name: String,
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§
§app_name: StringApplication name used in the HTML title tag
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 app_name(self, name: impl Into<String>) -> InertiaConfig
pub fn app_name(self, name: impl Into<String>) -> InertiaConfig
Set the application name used in the HTML title tag.
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
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
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
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
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>
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>
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 moreSource§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi Quirk value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);