pub struct OperatorGateState {
pub kind: OperatorGateKind,
pub subject: OperatorGateSubject,
pub input: OperatorGateInput,
pub options: Vec<OperatorGateOption>,
}Expand description
The full classification of a screen recognized as an OperatorGate,
replacing what used to be a bare label string. kind is always known (a
matcher only returns this type once it has matched a specific gate
phrase); subject, input, and options degrade independently to
Unknown/empty when the screen’s specific shape was not recognized –
never invented from kind alone.
Fields§
§kind: OperatorGateKind§subject: OperatorGateSubject§input: OperatorGateInput§options: Vec<OperatorGateOption>Recognized on-screen choices, in on-screen order. Empty means no
option list was recognized – NOT that the screen has no choices;
see OperatorGateInput::Unknown for the paired “input mechanism
unrecognized either” case.
Implementations§
Source§impl OperatorGateState
impl OperatorGateState
Sourcepub fn new(kind: OperatorGateKind) -> Self
pub fn new(kind: OperatorGateKind) -> Self
The gate with nothing known past kind – subject: Unknown,
input: Unknown, no options. This is the honest shape for a matched
kind whose screen a parser has not (yet) learned to read past the
phrase that identified it; never upgrade an unread screen into a
guessed subject or option list.
Sourcepub fn with_subject(self, subject: OperatorGateSubject) -> Self
pub fn with_subject(self, subject: OperatorGateSubject) -> Self
Builder-style: attach a recognized subject.
Sourcepub fn with_options(
self,
input: OperatorGateInput,
options: Vec<OperatorGateOption>,
) -> Self
pub fn with_options( self, input: OperatorGateInput, options: Vec<OperatorGateOption>, ) -> Self
Builder-style: attach a recognized input mechanism and its options
together, since one is meaningless without the other (an Unknown
input never carries options, and options never accompany an
unrecognized input mechanism).
Sourcepub fn is_valid(&self) -> bool
pub fn is_valid(&self) -> bool
Bounds check matching PtyScreenState::is_valid’s own rationale –
every string this type carries travels over the wire into an
operator UI and must be non-empty (where required), control-character
free, and within its per-field byte cap before anything downstream
trusts it.
Source§impl OperatorGateState
impl OperatorGateState
Sourcepub fn describe(&self) -> String
pub fn describe(&self) -> String
Longer operator-facing rendering than Display: the kind label,
plus a compact list of recognized options (currently-selected one
prefixed *) when options is non-empty. Display stays kind-only
on purpose (see its own doc comment) – this is for a surface that
can afford, and wants, the fuller picture once one was parsed.