pub struct InertiaConfig<V>where
V: ToString,{
pub url: &'static str,
pub version: InertiaVersion<V>,
pub template_resolver: Box<dyn TemplateResolver + Send + Sync>,
pub with_ssr: bool,
pub custom_ssr_client: Option<SsrClient>,
pub encrypt_history: bool,
}
Expand description
A configuration struct for initializing Inertia. You can directly fill the struct or use
the builder fluent syntax by calling InertiaConfig::builder()
, and finally InertiaConfig::build()
.
Note that, even with builder, most of fields are mandatory and trying to build without filling them
will cause your application to panic!
url
- A valid href of the current applicationversion
- The current asset version of the application. See Asset versioning for more details.template_resolver
- A valid template resolver. Check Template Resolvers chapter for more details.with_ssr
- Whether Server-side Rendering should be enabled or not.custom_ssr_client
- AnOption<SsrClient>
with the Inertia Server address. IfNone
is given,SsrClient::default
will be used.encrypt_history
- Whether to encrypt or not the session. Refer to History encryption for more details.
Fields§
§url: &'static str
§version: InertiaVersion<V>
§template_resolver: Box<dyn TemplateResolver + Send + Sync>
§with_ssr: bool
§custom_ssr_client: Option<SsrClient>
§encrypt_history: bool
Implementations§
Source§impl<V> InertiaConfig<V>where
V: ToString,
impl<V> InertiaConfig<V>where
V: ToString,
Sourcepub fn builder() -> InertiaConfigBuilder<V>
pub fn builder() -> InertiaConfigBuilder<V>
Instatiates a new InertiaConfigBuilder instance. It must be configured using a fluent syntax.
§Examples
use inertia_rust::{InertiaVersion, InertiaConfig};
let inertia_config = InertiaConfig::builder()
.set_url("http://localhost:8080")
.set_version(InertiaVersion::Literal("v1"))
.set_template_resolver(Box::new(YourTemplateResolver))
.build();
Auto Trait Implementations§
impl<V> Freeze for InertiaConfig<V>where
V: Freeze,
impl<V> !RefUnwindSafe for InertiaConfig<V>
impl<V> !Send for InertiaConfig<V>
impl<V> !Sync for InertiaConfig<V>
impl<V> Unpin for InertiaConfig<V>where
V: Unpin,
impl<V> !UnwindSafe for InertiaConfig<V>
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