Skip to main content

StorePhase

Enum StorePhase 

Source
pub enum StorePhase {
    Unavailable,
    Blocked,
    Connecting,
    Ready,
}
Expand description

How far along the store connection is.

Variants§

§

Unavailable

No store on this platform, or no backend installed, or one that has not reached the store yet. Nothing is owned and nothing can be bought right now — a backend that is retrying reports this, so an app may reasonably say “not reached” and offer to try again.

§

Blocked

The store answered, and it will not sell to this app here: in-app billing turned off on the device, an account that cannot pay, a country the app is not distributed in.

The difference from Unavailable is whether waiting helps. It does not here — no backend retries a store that has said no — so an app should stop offering the purchase and say why, rather than inviting a retry that can only fail the same way. Already-known ownership remains authoritative even though the store cannot be queried for new purchases.

§

Connecting

A backend is installed and still talking to the store. Prices are not known yet; owned entitlements may not be known yet either.

§

Ready

Product and entitlement information has been received at least once.

Implementations§

Source§

impl StorePhase

Source

pub fn cannot_sell(self) -> bool

Whether nothing can be bought in this phase.

Saves every paywall from spelling out the same two-variant match, and keeps an app that only cares “can I sell?” from having to be updated when a phase is added.

Source

pub fn may_yet_change(self) -> bool

Whether the store might still answer differently later.

True while a backend is connecting or has yet to reach the store, false once the store has said no or has already answered.

Trait Implementations§

Source§

impl Clone for StorePhase

Source§

fn clone(&self) -> StorePhase

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 Copy for StorePhase

Source§

impl Debug for StorePhase

Source§

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

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

impl Default for StorePhase

Source§

fn default() -> StorePhase

Returns the “default value” for a type. Read more
Source§

impl Eq for StorePhase

Source§

impl PartialEq for StorePhase

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for StorePhase

Auto Trait Implementations§

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

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.