Enum leptos_query::QueryState
source · pub enum QueryState<V> {
Created,
Loading,
Fetching(QueryData<V>),
Loaded(QueryData<V>),
Invalid(QueryData<V>),
}Expand description
The lifecycle of a query.
Each variant in the enum corresponds to a particular state of a query in its lifecycle, starting from creation and covering all possible transitions up to invalidation.
Variants§
Created
The initial state of a Query upon its creation.
In this state, a query is instantiated but no fetching operation has been initiated yet. This means that no data has been requested or received, and the query is in a “pending” state, waiting to begin its first fetch operation.
Loading
Query is fetching for the first time.
In this state, the query has started its first data fetching process. It is actively communicating with the data source and waiting for the data to be returned.
Fetching(QueryData<V>)
A Query is in the process of fetching, not being its first fetch.
In this state, a query is undergoing another fetch operation following a previous one.
The associated QueryData<V> object holds the previous data was fetched.
Loaded(QueryData<V>)
The state indicating that a query has successfully completed a fetch operation.
In this state, the query has finished fetching data.
The associated QueryData<V> object holds the successfully loaded data.
Invalid(QueryData<V>)
The state indicating that a query has completed a fetch, but the fetched data is marked as invalid.
The associated QueryData<V> object holds the invalidated data.
Implementations§
source§impl<V> QueryState<V>
impl<V> QueryState<V>
sourcepub fn query_data(&self) -> Option<&QueryData<V>>
pub fn query_data(&self) -> Option<&QueryData<V>>
Returns the QueryData for the current QueryState, if present.
sourcepub fn updated_at(&self) -> Option<Instant>
pub fn updated_at(&self) -> Option<Instant>
Returns the last updated timestamp for the QueryState, if present.
Trait Implementations§
source§impl<V: Clone> Clone for QueryState<V>
impl<V: Clone> Clone for QueryState<V>
source§fn clone(&self) -> QueryState<V>
fn clone(&self) -> QueryState<V>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl<V> Debug for QueryState<V>where
V: Debug,
impl<V> Debug for QueryState<V>where
V: Debug,
source§impl<V: PartialEq> PartialEq for QueryState<V>
impl<V: PartialEq> PartialEq for QueryState<V>
source§fn eq(&self, other: &QueryState<V>) -> bool
fn eq(&self, other: &QueryState<V>) -> bool
self and other values to be equal, and is used
by ==.impl<V: Eq> Eq for QueryState<V>
impl<V> StructuralPartialEq for QueryState<V>
Auto Trait Implementations§
impl<V> RefUnwindSafe for QueryState<V>where
V: RefUnwindSafe,
impl<V> Send for QueryState<V>where
V: Send,
impl<V> Sync for QueryState<V>where
V: Sync,
impl<V> Unpin for QueryState<V>where
V: Unpin,
impl<V> UnwindSafe for QueryState<V>where
V: UnwindSafe,
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
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.