Skip to main content

QueryPhase

Enum QueryPhase 

Source
pub enum QueryPhase<T> {
    Load(LoadState<T>),
    Stale(Rc<T>),
    Cancelled(Option<Rc<T>>),
}
Expand description

在 LoadState 之上补 0.6 需要的 Stale / Cancelled 两态。

Variants§

§

Load(LoadState<T>)

底层 LoadState(Idle / Loading / Ready / Refreshing / Failed)

§

Stale(Rc<T>)

新请求已发出,旧数据仍可展示,但不视为最新

§

Cancelled(Option<Rc<T>>)

已取消,保留最后已知数据;不进错误态

Implementations§

Source§

impl<T> QueryPhase<T>

Source

pub fn status(&self) -> LoadStatus

UI 组件可直接消费的进度值:Stale 视为 Refreshing,Cancelled 视为 Idle。

Source

pub fn data(&self) -> Option<&Rc<T>>

最后已知数据:加载中/刷新中/失败保留/Stale/取消都允许继续展示。

Source

pub fn error(&self) -> Option<&str>

可展示的错误原因;取消不是错误,返回 None。

Trait Implementations§

Source§

impl<T: Clone> Clone for QueryPhase<T>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<T: Debug> Debug for QueryPhase<T>

Source§

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

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

impl<T: PartialEq> PartialEq for QueryPhase<T>

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl<T: PartialEq> StructuralPartialEq for QueryPhase<T>

Auto Trait Implementations§

§

impl<T> !Send for QueryPhase<T>

§

impl<T> !Sync for QueryPhase<T>

§

impl<T> Forget for QueryPhase<T>

§

impl<T> Freeze for QueryPhase<T>
where *const RcInner<T> is !null: Freeze, PhantomData<RcInner<T>>: Freeze, *const RcInner<str> is !null: Freeze, PhantomData<RcInner<str>>: Freeze,

§

impl<T> Move for QueryPhase<T>

§

impl<T> RefUnwindSafe for QueryPhase<T>

§

impl<T> Unpin for QueryPhase<T>
where Rc<T>: Unpin, Rc<str>: Unpin,

§

impl<T> UnsafeUnpin for QueryPhase<T>
where *const RcInner<T> is !null: UnsafeUnpin, PhantomData<RcInner<T>>: UnsafeUnpin, *const RcInner<str> is !null: UnsafeUnpin, PhantomData<RcInner<str>>: UnsafeUnpin,

§

impl<T> UnwindSafe for QueryPhase<T>
where Rc<T>: UnwindSafe, Rc<str>: 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
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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,

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.