pub struct Act<'a> {
pub label: &'a str,
pub key: Option<&'a str>,
pub tone: Tone,
pub state: Option<State>,
}Expand description
Something the user can do, and what it costs to say so.
Added 0.17.0, out of quasi-tui: the terminal renderer had drawn one of
these for months and every other consumer that wanted a button had written
its own, because this layer named RowPart::Actions as a slot and never
named the thing that goes in it. Beside Meter and Figure for the
reason those are here: a renderer that is handed the parts has to decide how
to say them, and a renderer that is handed a finished string has already had
the decision made for it.
No address. Where a control goes is the app’s business and every host
follows it differently — an hx-get, a protocol URL, a function call — so
the description says what the control is and the caller keeps what it
does. That is the same split Choice makes.
No confirmation flag either, and that one is a finding rather than an omission: a question asked after a control is pressed belongs to whatever is holding the interaction, and a renderer that drew it would be asking before there was anything to answer.
Fields§
§label: &'a strWhat the control says.
key: Option<&'a str>The key that reaches it where a host has keys.
The one member written for a terminal before there was one. A webview
hangs it off accesskey or ignores it; a terminal has nothing else to
offer, so this is the whole of how a control is reached there.
tone: ToneWhat pressing it means. Tone::Danger is the destructive one.
state: Option<State>Focus, disabled, or neither.
State::Disabled is the one that changes what a renderer may do:
see State::suppresses_interaction, which is what says a disabled
control is drawn and not reachable.