Trait InertiaFacade

Source
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§

Source

fn render<'life0, 'async_trait>( req: &'life0 THttpRequest, component: Component, ) -> Pin<Box<dyn Future<Output = Result<TResponse, InertiaError>> + 'async_trait>>
where 'life0: 'async_trait,

Renders an Inertia Page as an HTTP response.

§Arguments
  • req - A reference to the HTTP request.
  • component - The page javascript component name to be rendered by the client-side adapter.
§Panic

Panics if Inertia instance hasn’t been configured (set to AppData).

Source

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 - A TProps (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).

Source

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.
Source

fn encrypt_history(req: &THttpRequest, encrypt: bool)

Whether to encrypt or not the current request. Refer to History Encrypt for more details.

Source

fn clear_history(req: &THttpRequest)

Triggers a history clearing from server-side. Refer to History Encrypt for more details.

Source

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.

Source

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.

Source

fn view_data(req: &THttpRequest, data: HashMap<&str, Value>)

Inserts custom view data to be accessed by the template root.

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.

Implementors§