Skip to main content

Awaiting

Struct Awaiting 

Source
#[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 itwhat it does
a control that was pressedgoes busy and refuses a second press until it resolves
a region fed by itstands 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
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional 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

Source

pub const fn unmeasured() -> Self

A wait with no countable size.

Source

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.

Source

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.

Trait Implementations§

Source§

impl Clone for Awaiting

Source§

fn clone(&self) -> Awaiting

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 Awaiting

Source§

impl Debug for Awaiting

Source§

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

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

impl Default for Awaiting

Source§

fn default() -> Awaiting

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

impl Eq for Awaiting

Source§

impl Hash for Awaiting

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 Awaiting

Source§

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

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.