pub struct InertiaConfigBuilder<T, V>where
T: 'static,
V: ToString,{
pub url: Option<&'static str>,
pub version: Option<InertiaVersion<V>>,
pub template_path: Option<&'static str>,
pub template_resolver: Option<&'static (dyn Fn(&'static str, ViewData, &'static T) -> TemplateResolverOutput + Send + Sync + 'static)>,
pub template_resolver_data: Option<&'static T>,
pub with_ssr: bool,
pub custom_ssr_client: Option<SsrClient>,
pub view_data: Option<Map<String, Value>>,
pub reflash_inertia_session: Option<Box<dyn Fn(Option<InertiaTemporarySession>) -> Result<(), InertiaError> + Send + Sync>>,
}
Fields§
§url: Option<&'static str>
§version: Option<InertiaVersion<V>>
§template_path: Option<&'static str>
§template_resolver: Option<&'static (dyn Fn(&'static str, ViewData, &'static T) -> TemplateResolverOutput + Send + Sync + 'static)>
§template_resolver_data: Option<&'static T>
§with_ssr: bool
§custom_ssr_client: Option<SsrClient>
§view_data: Option<Map<String, Value>>
§reflash_inertia_session: Option<Box<dyn Fn(Option<InertiaTemporarySession>) -> Result<(), InertiaError> + Send + Sync>>
Implementations§
Source§impl<T, V> InertiaConfigBuilder<T, V>where
T: 'static,
V: ToString,
impl<T, V> InertiaConfigBuilder<T, V>where
T: 'static,
V: ToString,
Sourcepub fn new() -> Self
pub fn new() -> Self
Instatiates a new InertiaConfigBuilder instance. It must be configured using a fluent syntax.
§Examples
use inertia_rust::{InertiaConfigBuilder, InertiaVersion};
let inertia_config = InertiaConfigBuilder::new()
.set_url("http://localhost:8080")
.set_version(InertiaVersion::Literal("v1"))
.set_template_path("path/to/template.html")
.set_template_resolver(&your_template_resolver)
.set_template_resolver_data(&())
.build();
pub fn set_ssr_client(self, ssr_client: SsrClient) -> Self
pub fn set_url(self, url: &'static str) -> Self
pub fn set_version(self, version: InertiaVersion<V>) -> Self
pub fn set_template_path(self, template_path: &'static str) -> Self
pub fn set_template_resolver( self, template_resolver: &'static (dyn Fn(&'static str, ViewData, &'static T) -> TemplateResolverOutput + Send + Sync + 'static), ) -> Self
pub fn set_template_resolver_data(self, data: &'static T) -> Self
pub fn set_view_data(self, view_data: Map<String, Value>) -> Self
pub fn set_reflash_fn( self, reflash_inertia_session_fn: Box<dyn Fn(Option<InertiaTemporarySession>) -> Result<(), InertiaError> + Send + Sync>, ) -> Self
pub fn enable_ssr(self) -> Self
Sourcepub fn build(self) -> InertiaConfig<T, V>
pub fn build(self) -> InertiaConfig<T, V>
Trait Implementations§
Auto Trait Implementations§
impl<T, V> Freeze for InertiaConfigBuilder<T, V>where
V: Freeze,
impl<T, V> !RefUnwindSafe for InertiaConfigBuilder<T, V>
impl<T, V> !Send for InertiaConfigBuilder<T, V>
impl<T, V> !Sync for InertiaConfigBuilder<T, V>
impl<T, V> Unpin for InertiaConfigBuilder<T, V>where
V: Unpin,
impl<T, V> !UnwindSafe for InertiaConfigBuilder<T, 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