#[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
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
impl Readiness
Sourcepub const fn shows_content(self) -> bool
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.
Sourcepub const fn tone(self) -> Tone
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.