Skip to main content

Readiness

Enum Readiness 

Source
#[non_exhaustive]
pub enum Readiness { Ready, Pending, Empty, Failed, }
Expand description

What is in a region right now.

The state, not the shimmer. Whether pending paints a skeleton, a spinner or nothing at all is renderer policy, the same class of decision that got Fill::fallback deleted from this crate. goingson and Balanced Breakfast each grew a skeleton with differently-named parts; both keep them, as the webview renderer’s expression of Readiness::Pending. audiofiles has none and needs none, because an immediate-mode renderer simply repaints.

§Four states and not two, as of 0.12.0

703f4cd2. It named Ready and Pending and stopped, so a described screen whose list came back empty had to render an empty region or invent its own placeholder text, and neither says what it is. goingson draws one at 27 sites across 12 files and Balanced Breakfast at 9, with a class family that had already drifted into empty-state, empty-state--error, error-state and six more.

The four are one axis because they are mutually exclusive: a region shows its content, or a sign that it is coming, or a sign that there is none, or a sign that it broke. Never two. That is the test for one enum against several fields, and it is why this grew rather than a new member arriving beside it.

§What is not here

The message. “No projects yet” is content, and this names a state. It lives with whatever holds the region — in quasi’s case a Slot — alongside the action that leads out of the emptiness, since an address is the one thing this crate never names.

How much room it gets. goingson’s --compact, --dashboard and --padded are the same state at three sizes, and a size is makeover-geometry’s question. Naming them here would be this crate stating values again.

The icon. Presentation, and each host has its own answer or none.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Ready

The content is here.

§

Pending

The content is on its way.

§

Empty

The content arrived and there is none of it.

Not a failure. An empty list is the normal state of a new install, and a renderer that drew it in a danger tone would be reporting a fault where there is none.

§

Failed

The content did not arrive.

Implementations§

Source§

impl Readiness

Source

pub const fn shows_content(self) -> bool

Whether the region draws its own content, or something standing in for it.

The question every renderer asks first, so it is answered once here rather than by a matches! in each. A state added later is a stand-in until proven otherwise: falling back to drawing content that may not be there is the worse of the two mistakes.

Source

pub const fn tone(self) -> Tone

What the state means, for a renderer choosing a colour.

Derived rather than carried, which is the opposite of Meter and Figure, and the difference is worth stating: a proportion’s meaning depends on what is being counted and only the app knows it, while “nothing here yet” and “this broke” mean the same thing in every app that will ever have them.

Trait Implementations§

Source§

impl Clone for Readiness

Source§

fn clone(&self) -> Readiness

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 Readiness

Source§

impl Debug for Readiness

Source§

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

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

impl Eq for Readiness

Source§

impl Hash for Readiness

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Readiness

Source§

fn eq(&self, other: &Readiness) -> 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 Readiness

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.