#[non_exhaustive]pub struct Awaiting {
pub amount: Option<u64>,
}Expand description
An action is waiting on something that resolves once, in expected finite time.
The control-side sibling of Readiness. That enum names four states for a
region and named nothing at all for the button that is currently doing what
it was clicked for, so the in-flight treatment is hand-written wherever it
exists: the MNW server carries 57 in-flight indicators against 2 guards
against a second press, which is the spinner mostly present and the guard
mostly absent, on a codebase whose money path is a purchase button.
§What is described here, and what is not
The fact is that there is an outstanding thing which will complete. Not that the address is remote: a heavy local query waits too, and a server calling a payment provider is not the browser leaving the app. Not that the call is slow either, which is a judgement about a call rather than a property of one.
Resolving once is the boundary, and it is what separates this from a screen that keeps changing. A live screen never resolves and has no name in this crate yet.
§One mark, two renderings
| what reads it | what it does |
|---|---|
| a control that was pressed | goes busy and refuses a second press until it resolves |
| a region fed by it | stands in as Readiness::Pending, then fills |
The two were on the table separately and both were taken. Controls alone leaves a slow region hand-split into its own route, which is what MNW’s user dashboard does with its payout summary; regions alone leaves the purchase button unguarded.
§A quantity when it is measured, never a duration
amount is stated only when it is a measured fact about the
payload. An upload’s file length, yes; a round trip to a payment provider,
None. A duration is described nowhere, and a renderer may not manufacture
one from the amount either: a determinate bar shows what is done over what
there is, plus the time it has taken so far, and never a remaining time, an
arrival time or a rate extrapolated forwards. A prediction is wrong the
moment the transfer stalls, and being confidently wrong is worse than being
honestly indeterminate.
This is why the crate refuses to say how long an undo stays offered and accepts a byte count here. The refusal is about naming a decision that belongs to the renderer; a file’s length is not a decision, nobody chose it.
§Not Meter
Meter is how much of a set is done, and its own docs refuse the progress
of an operation on the grounds that a description is built once and dropped
while an operation runs between renders. That refusal stands. This names the
operation and its size, which is all that is known before it starts; how much
of it has gone through is the renderer’s to observe live, and nothing round
trips through a description to say so.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.amount: Option<u64>Total work to get through, when it is a measured fact about the payload.
None when the wait has no countable size, which is the common case and
the default.
Unit-agnostic on purpose. Bytes for an upload, rows for an import; what is being counted is the app’s business and a renderer draws a proportion either way.
Implementations§
Source§impl Awaiting
impl Awaiting
Sourcepub const fn unmeasured() -> Self
pub const fn unmeasured() -> Self
A wait with no countable size.
Sourcepub const fn of(amount: u64) -> Self
pub const fn of(amount: u64) -> Self
A wait whose size is known.
Reach for it only with a measured figure. An estimate written in here is a prediction wearing a fact’s clothes, and the renderer has no way to tell the two apart.
Sourcepub const fn is_determinate(self) -> bool
pub const fn is_determinate(self) -> bool
Whether there is a proportion to draw.
The question every renderer asks first, answered once here rather than by
a matches! in each. False means indeterminate, which is the honest
drawing when nothing countable was measured.