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>

source

pub fn query_data(&self) -> Option<&QueryData<V>>

Returns the QueryData for the current QueryState, if present.

source

pub fn data(&self) -> Option<&V>

Returns the data contained within the QueryState, if present.

source

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>

source§

fn clone(&self) -> QueryState<V>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<V> Debug for QueryState<V>
where V: Debug,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<V: PartialEq> PartialEq for QueryState<V>

source§

fn eq(&self, other: &QueryState<V>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<V: Eq> Eq for QueryState<V>

source§

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

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

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

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

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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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>,

§

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

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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

impl<El> ElementDescriptorBounds for El
where El: Debug,