pub trait TemplateResolver {
// Required method
fn resolve_template<'life0, 'life1, 'async_trait>(
&'life0 self,
view_data: ViewData<'life1>,
) -> Pin<Box<dyn Future<Output = Result<String, InertiaError>> + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Required Methods§
Sourcefn resolve_template<'life0, 'life1, 'async_trait>(
&'life0 self,
view_data: ViewData<'life1>,
) -> Pin<Box<dyn Future<Output = Result<String, InertiaError>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn resolve_template<'life0, 'life1, 'async_trait>(
&'life0 self,
view_data: ViewData<'life1>,
) -> Pin<Box<dyn Future<Output = Result<String, InertiaError>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
A function responsible for rendering the root template with the given view data.
This should be relative by the template engine you are using, and it is mandatory for rendering the HTML to be served on full requests. Since Rust does not offer a standard template engine, there are various options, and it is not our goal to tie you to a specific one which we opted to use.
§Arguments
Inertia will call this function passing the following parameters to it:
view_data- AViewDatastruct,
§Errors
Returns an InertiaError::RenderError if it fails to render the html.
§Return
The return must be the template rendered to HTML. It will be sent as response to full requests.