pub enum InertiaProp<'a> {
Data(Result<Value, InertiaError>),
Lazy(Arc<dyn Fn() -> Pin<Box<dyn Future<Output = Result<Value, InertiaError>> + Send>> + Send + Sync>),
Always(Result<Value, InertiaError>),
Demand(Arc<dyn Fn() -> Pin<Box<dyn Future<Output = Result<Value, InertiaError>> + Send>> + Send + Sync>),
Deferred(Arc<dyn Fn() -> Pin<Box<dyn Future<Output = Result<Value, InertiaError>> + Send>> + Send + Sync>, Option<&'a str>),
Mergeable(Box<InertiaProp<'a>>),
}
Variants§
Data(Result<Value, InertiaError>)
- ALWAYS included on standard visits
- OPTIONALLY included on partial reloads
- ALWAYS evaluated
Lazy(Arc<dyn Fn() -> Pin<Box<dyn Future<Output = Result<Value, InertiaError>> + Send>> + Send + Sync>)
- ALWAYS included on standard visits
- OPTIONALLY included on partial reloads
- ONLY evaluated when included
Always(Result<Value, InertiaError>)
- ALWAYS included on standard visits
- ALWAYS included on partial reloads (even if not requested or excepted)
- ALWAYS evaluated
Demand(Arc<dyn Fn() -> Pin<Box<dyn Future<Output = Result<Value, InertiaError>> + Send>> + Send + Sync>)
- NEVER included on standard visits
- OPTIONALLY included on partial reloads
- ONLY evaluated when needed
Deferred(Arc<dyn Fn() -> Pin<Box<dyn Future<Output = Result<Value, InertiaError>> + Send>> + Send + Sync>, Option<&'a str>)
Exactly the same as InertiaProp::Demand
, except that it will be automatically
fetched by Inertia when the page is first loaded.
Refer to Deferred Props for more details.
Mergeable(Box<InertiaProp<'a>>)
Make a property mergeable. Refer to Merging Props documentation for more details.
It can only hold the InertiaProp::Data
and InertiaProp::Deferred
variants of InertiaProp
.
Implementations§
Source§impl<'a> InertiaProp<'a>
impl<'a> InertiaProp<'a>
Sourcepub fn into_mergeable(self) -> InertiaProp<'a>
pub fn into_mergeable(self) -> InertiaProp<'a>
Converts an InertiaProp to
InertiaMergeableProp`.
§Panics
Will panic if the prop isn’t neither InertiaProp::Data
nor InertiaProp::Deferred
variants.
pub fn data<T>(value: T) -> InertiaProp<'a>where
T: Serialize,
pub fn always<T>(value: T) -> InertiaProp<'a>where
T: Serialize,
pub fn merge<T>(value: T) -> InertiaProp<'a>where
T: Serialize,
pub fn lazy( resolver: Arc<dyn Fn() -> Pin<Box<dyn Future<Output = Result<Value, InertiaError>> + Send>> + Send + Sync>, ) -> InertiaProp<'a>
pub fn demand( resolver: Arc<dyn Fn() -> Pin<Box<dyn Future<Output = Result<Value, InertiaError>> + Send>> + Send + Sync>, ) -> InertiaProp<'a>
pub fn defer( resolver: Arc<dyn Fn() -> Pin<Box<dyn Future<Output = Result<Value, InertiaError>> + Send>> + Send + Sync>, ) -> InertiaProp<'a>
pub fn defer_with_group( resolver: Arc<dyn Fn() -> Pin<Box<dyn Future<Output = Result<Value, InertiaError>> + Send>> + Send + Sync>, group: &'a str, ) -> InertiaProp<'a>
Trait Implementations§
Source§impl<'a> Clone for InertiaProp<'a>
impl<'a> Clone for InertiaProp<'a>
Source§fn clone(&self) -> InertiaProp<'a>
fn clone(&self) -> InertiaProp<'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 moreAuto Trait Implementations§
impl<'a> Freeze for InertiaProp<'a>
impl<'a> !RefUnwindSafe for InertiaProp<'a>
impl<'a> Send for InertiaProp<'a>
impl<'a> Sync for InertiaProp<'a>
impl<'a> Unpin for InertiaProp<'a>
impl<'a> !UnwindSafe for InertiaProp<'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