#[non_exhaustive]pub enum Prompt {
Confirm {
question: String,
default: Option<bool>,
},
Text {
label: String,
validator: ValidatorSpec,
},
Secret {
label: String,
validator: ValidatorSpec,
},
Literal {
label: String,
expected: String,
},
Continue {
hint: Option<String>,
},
Reveal {
label: String,
note: Option<String>,
shown: Shown,
},
EnterRows {
label: String,
note: Option<String>,
format: RevealFormat,
rows: Option<usize>,
validator: Option<ValidatorSpec>,
},
}Expand description
Request for user input, recorded into the transcript as part of
StepFact::PromptAnswered.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Confirm
Yes / no question with an optional default.
Fields
Text
Free-form text input, validated against a ValidatorSpec.
Fields
validator: ValidatorSpecValidator applied before the response is accepted.
Secret
Sensitive input (PIN, password). Echo is suppressed; plaintext is never serialized to the transcript.
Fields
validator: ValidatorSpecValidator applied before the response is accepted.
Literal
User must type a specific literal string exactly. Validation is
performed by the runtime against expected.
Continue
Wait for the user to acknowledge before proceeding. Used for pacing.
Reveal
Show a value while the prompt is up, and withdraw it when the person acknowledges. What was shown is never recorded: the transcript carries the label and the acknowledgement.
Fields
EnterRows
Rows of a value a person types from a sheet, one at a time, each checked as it is entered. The answer is a secret: the transcript carries the label and that an answer was given, never the rows.
Fields
format: RevealFormatThe encoding the sheet was written in.
rows: Option<usize>Rows expected, when the step knows the value’s length; without it a short row, or an empty row after full ones, ends the entry.
validator: Option<ValidatorSpec>The rule the rows as a whole must satisfy, which the runtime
checks and a rehearsal can build a stand-in for. None when the
step checks the value itself, as for a share, which no made-up
value is.
Implementations§
Source§impl Prompt
impl Prompt
Sourcepub fn for_record(&self) -> Self
pub fn for_record(&self) -> Self
The prompt as the transcript records it: the same, except that a value shown for writing down is left out, so no copy of it travels with the fact.