pub trait InertiaFacade<THttpRequest, TResponse, TRedirect> {
// Required methods
fn render<'life0, 'async_trait>(
req: &'life0 THttpRequest,
component: Component,
) -> Pin<Box<dyn Future<Output = Result<TResponse, InertiaError>> + 'async_trait>>
where 'life0: 'async_trait;
fn render_with_props<'life0, 'life1, 'async_trait>(
req: &'life0 THttpRequest,
component: Component,
props: InertiaProps<'life1>,
) -> Pin<Box<dyn Future<Output = Result<TResponse, InertiaError>> + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait;
fn location(req: &THttpRequest, url: &str) -> TResponse;
fn encrypt_history(req: &THttpRequest, encrypt: bool);
fn clear_history(req: &THttpRequest);
fn back(req: &THttpRequest) -> TRedirect;
fn back_with_errors<Key: ToString>(
req: &THttpRequest,
errors: HashMap<Key, Value>,
) -> TRedirect;
fn view_data(req: &THttpRequest, data: HashMap<&str, Value>);
}
Required Methods§
Sourcefn render<'life0, 'async_trait>(
req: &'life0 THttpRequest,
component: Component,
) -> Pin<Box<dyn Future<Output = Result<TResponse, InertiaError>> + 'async_trait>>where
'life0: 'async_trait,
fn render<'life0, 'async_trait>(
req: &'life0 THttpRequest,
component: Component,
) -> Pin<Box<dyn Future<Output = Result<TResponse, InertiaError>> + 'async_trait>>where
'life0: 'async_trait,
Sourcefn render_with_props<'life0, 'life1, 'async_trait>(
req: &'life0 THttpRequest,
component: Component,
props: InertiaProps<'life1>,
) -> Pin<Box<dyn Future<Output = Result<TResponse, InertiaError>> + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
fn render_with_props<'life0, 'life1, 'async_trait>(
req: &'life0 THttpRequest,
component: Component,
props: InertiaProps<'life1>,
) -> Pin<Box<dyn Future<Output = Result<TResponse, InertiaError>> + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Renders an Inertia Page with props as an HTTP response.
§Arguments
req
- A reference to the HTTP request.component
- The page component to be rendered by the client-side adapter.props
- ATProps
(serializable) struct containing the props to be sent to the client-side.
§Errors
This operation may result in one of InertiaErrors if the props struct
or any of its fields don’t implement Serialize
trait.
§Panics
Panics if Inertia instance hasn’t been configured (set to AppData).
Sourcefn location(req: &THttpRequest, url: &str) -> TResponse
fn location(req: &THttpRequest, url: &str) -> TResponse
Provokes a client-side redirect to an extern URL.
§Arguments
req
- A reference to the HTTP request.url
- The URL to be redirected to.
Sourcefn encrypt_history(req: &THttpRequest, encrypt: bool)
fn encrypt_history(req: &THttpRequest, encrypt: bool)
Whether to encrypt or not the current request. Refer to History Encrypt for more details.
Sourcefn clear_history(req: &THttpRequest)
fn clear_history(req: &THttpRequest)
Triggers a history clearing from server-side. Refer to History Encrypt for more details.
Sourcefn back(req: &THttpRequest) -> TRedirect
fn back(req: &THttpRequest) -> TRedirect
Triggers a redirect to the previous URL (or “/”, if there is no previous URL). Please refer to Flash Messages and Validation Errors for more information.
Sourcefn back_with_errors<Key: ToString>(
req: &THttpRequest,
errors: HashMap<Key, Value>,
) -> TRedirect
fn back_with_errors<Key: ToString>( req: &THttpRequest, errors: HashMap<Key, Value>, ) -> TRedirect
Triggers a redirect to the previous URL (or “/”, if there is no previous URL) with errors. Please refer to Flash Messages and Validation Errors for more information.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.