pub struct InertiaPage<'a> { /* private fields */ }
Expand description
Response containing a valid Inertia Payload that will be used by the Inertia client to render the components.
Implementations§
Source§impl<'a> InertiaPage<'a>
impl<'a> InertiaPage<'a>
Sourcepub fn new(
component: Component,
url: &'a str,
version: Option<&'a str>,
props: Map<String, Value>,
merge_props: Option<Vec<&'a str>>,
deferred_props: Option<HashMap<&'a str, Vec<&'a str>>>,
clear_history: bool,
encrypt_history: bool,
) -> Self
pub fn new( component: Component, url: &'a str, version: Option<&'a str>, props: Map<String, Value>, merge_props: Option<Vec<&'a str>>, deferred_props: Option<HashMap<&'a str, Vec<&'a str>>>, clear_history: bool, encrypt_history: bool, ) -> Self
Instantiates an Inertia Page object to sent as http response, according to Inertia Protocol.
§Arguments
component
- The name of the javascript page component (e.g. “/Me”).url
- The Inertia instance’s url (the application URL). It can be a whole href or an absolute hostless path (“/me”).version
- Current assets version. Used to assert assets are up-to-date. See Inertia’s assets versioning page for more details.props
- A map of the page’s props.merge_props
- A list containing the keys of the properties that shall me merged by the client-side adapter.deferred_props
- A hashmap of which the keys are groups. It contains the keys of the props that must be fetched by the client-side adapter after the first page load. Refer to Deferred Props for more details.clear_history
- Whether the history must be cleaned by the client-side once this response is received. Refer to Clearing history section from History Encryption documentatin for more details.encrypt_history
- Whether the client-side adapter must encrypt the history page data related to this response. Refer to History Encryption for more details.
pub fn get_props(&self) -> &Map<String, Value>
pub fn get_component(&self) -> &Component
pub fn get_url(&self) -> &str
pub fn get_version(&self) -> &Option<&str>
pub fn get_clear_history(&self) -> bool
pub fn get_encrypt_history(&self) -> bool
pub fn get_deferred_props(&self) -> &Option<HashMap<&'_ str, Vec<&'_ str>>>
pub fn get_merge_props(&self) -> &Option<Vec<&str>>
Trait Implementations§
Source§impl<'a> Clone for InertiaPage<'a>
impl<'a> Clone for InertiaPage<'a>
Source§fn clone(&self) -> InertiaPage<'a>
fn clone(&self) -> InertiaPage<'a>
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<'a> Debug for InertiaPage<'a>
impl<'a> Debug for InertiaPage<'a>
Source§impl<'de: 'a, 'a> Deserialize<'de> for InertiaPage<'a>
impl<'de: 'a, 'a> Deserialize<'de> for InertiaPage<'a>
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<'a> PartialEq for InertiaPage<'a>
impl<'a> PartialEq for InertiaPage<'a>
Source§impl<'a> Serialize for InertiaPage<'a>
impl<'a> Serialize for InertiaPage<'a>
impl<'a> Eq for InertiaPage<'a>
impl<'a> StructuralPartialEq for InertiaPage<'a>
Auto Trait Implementations§
impl<'a> Freeze for InertiaPage<'a>
impl<'a> RefUnwindSafe for InertiaPage<'a>
impl<'a> Send for InertiaPage<'a>
impl<'a> Sync for InertiaPage<'a>
impl<'a> Unpin for InertiaPage<'a>
impl<'a> UnwindSafe for InertiaPage<'a>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoInertiaPropResult for Twhere
T: Serialize,
impl<T> IntoInertiaPropResult for Twhere
T: Serialize,
Source§fn into_inertia_value(self) -> Result<Value, InertiaError>
fn into_inertia_value(self) -> Result<Value, InertiaError>
Converts a serializeable object into a
serde_json::Value
. If it fails,
automatically maps the error to InertiaError
.