pub struct Input { /* private fields */ }Expand description
A one-line text input field.
Implementations§
Source§impl Input
impl Input
Sourcepub fn new(
key: FieldKey<String>,
question: impl Into<String>,
initial_value: impl Into<String>,
) -> Result<Self, FieldConfigError>
pub fn new( key: FieldKey<String>, question: impl Into<String>, initial_value: impl Into<String>, ) -> Result<Self, FieldConfigError>
Creates an input with a typed key, prompt question, and initial value.
Sourcepub fn placeholder(self, placeholder: impl Into<String>) -> Self
pub fn placeholder(self, placeholder: impl Into<String>) -> Self
Sets text shown when the current value is empty.
placeholder is plain text. Escape sequences in it are counted as ordinary
characters when the prompt measures its cells, so a pre-styled string
mis-aligns the field; style it through the prompt’s theme instead.
Sourcepub fn description(self, description: impl Into<String>) -> Self
pub fn description(self, description: impl Into<String>) -> Self
Sets supporting text shown below the question.
description is plain text. Escape sequences in it are counted as ordinary
characters when the prompt measures its cells, so a pre-styled string
mis-aligns the field; style it through the prompt’s theme instead.
Sourcepub fn help(self, help: impl Into<String>) -> Self
pub fn help(self, help: impl Into<String>) -> Self
Sets the navigation hint shown beneath the field.
help is plain text. Escape sequences in it are counted as ordinary
characters when the prompt measures its cells, so a pre-styled string
mis-aligns the field; style it through the prompt’s theme instead.
Sourcepub fn required_message(self, message: impl Into<String>) -> Self
pub fn required_message(self, message: impl Into<String>) -> Self
Sets the message shown when a required input is empty.