// Names this module's prose links to, resolved for rustdoc. #[allow(unused_imports)] use crate::{Field, FieldKind, Unit}; /// One option offered by a field [`FieldKind::offers_options`] accepts. /// /// Two strings, because the submitted value and the read label are different /// facts and every renderer that has tried to collapse them has had to /// un-collapse them later. `makeover-webview` invented this shape writing its /// form emitter and it is taken here unchanged; moving it down rather than /// re-deriving it is the point, since the second and third renderers were each /// going to arrive at a near-miss of it. /// `#[non_exhaustive]`, which every type here that a renderer matches or builds /// carries. Without it a new member is a breaking change at every literal site /// in the tree. #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] #[non_exhaustive] pub struct Choice<'a> { /// What is submitted. pub value: &'a str, /// What is read. pub label: &'a str, /// Why it cannot be picked right now, when it cannot. /// /// One member rather than an `available: bool` beside a reason, and the /// conflation is the point: an option greyed out with no explanation is a /// dead end the user cannot act on, and it is exactly the state the app /// that found this gap had to patch by hand with a line of prose under the /// control. Making the reason mandatory means the description cannot say /// the useless half. /// /// The option stays in the list. Dropping it is what an app does today, and /// it costs the user the knowledge that the thing exists at all — /// audiofiles' multi-sample mode appears on its own once a second sample is /// dropped, so a user who never sees it never learns what to drop. /// /// **Not [`Field::error`], and not [`Field::hint`].** An error is about the /// answer and a hint is standing help for the whole question; this is about /// one option among several, which is the level neither of those reaches. /// /// **Not disabled-the-state.** `State::Disabled` is about a whole field /// refusing to answer. This says the field is live and one of its answers /// is not available yet, which is a different sentence and the reason the /// tone rule matters here: the *other* options are still usable. pub unavailable: Option<&'a str>, /// The line under the label that says what picking this means. /// /// A choice between three plans is a choice nobody can make from three /// names, and until this existed the description had nowhere to put the /// sentence that made it makeable. What the corpus did instead is the /// tell: four of the six measured sites fold it into the label — /// `Public: Anyone can see this repository` in MNW's git /// settings, the same shape in its project-basics AI tier and its cart's /// currency conversion, and `Mislabeled (wrong AI tier or category)` in /// its report modal. The described screens do it too, in miniature: `Every /// 15 minutes (recommended)`, `Reference samples in place (loose-files /// mode)`. One fact, six spellings, no member. /// /// # Where it goes is the host's, and the rule already exists /// /// This is [`unavailable`](Self::unavailable)'s question met a third time /// and it takes the same answer, which is the strongest evidence one member /// is right rather than two. A radio group has room and gives the line its /// own element beside the label. A `