Struct InertiaConfig

Source
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 application
  • version - 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 - An Option<SsrClient> with the Inertia Server address. If None 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,

Source

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T