Struct inquire::CustomType[][src]

pub struct CustomType<'a, T> {
    pub message: &'a str,
    pub default: Option<(T, CustomTypeFormatter<'a, T>)>,
    pub help_message: Option<&'a str>,
    pub formatter: CustomTypeFormatter<'a, T>,
    pub parser: CustomTypeParser<'a, T>,
    pub error_message: String,
}
Expand description

Prompt to retrieve custom types automatically parsed from the user’s input.

Fields

message: &'a str

Message to be presented to the user.

default: Option<(T, CustomTypeFormatter<'a, T>)>

Default value, returned when the user input is empty.

help_message: Option<&'a str>

Help message to be presented to the user.

formatter: CustomTypeFormatter<'a, T>

Function that formats the user input and presents it to the user as the final rendering of the prompt.

parser: CustomTypeParser<'a, T>

Function that parses the user input and returns the result value.

error_message: String

Error message displayed when value could not be parsed from input.

Implementations

Creates a CustomType with the provided message and default configuration values.

Sets the default input.

Sets the help message of the prompt.

Sets the formatter

Sets the parser.

Sets a custom error message displayed when a submission could not be parsed to a value.

Parses the provided behavioral and rendering options and prompts the CLI user for input according to the defined rules.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.