Struct read_input::InputBuilder[][src]

pub struct InputBuilder<T: FromStr> { /* fields omitted */ }
Expand description

‘builder’ used to store the settings that are used to fetch input.

.get() method only takes these settings by reference so can be called multiple times.

This type does not have support for default input value.

Implementations

Creates a new instance of InputBuilder with default settings.

‘gets’ the input form the user.

Panics if unable to read input line.

‘gets’ the input form the user.

Errors

Returns Err if unable to read input line.

Changes or adds a default input value.

If the user presses enter before typing anything .get() will return a default value when InputBuilder::default is used.

let input = input().msg("Please input pi: ").default(3.141).get();

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Returns the “default value” for a type. Read more

Changes or adds a prompt message that gets printed once when input if fetched. Read more

Changes or adds a prompt message and that is repeated each time input is requested. Read more

Changes fallback error message. Read more

Adds a validation check on input to ensure the value meets your criteria. Read more

Does the same thing as InputBuild::err, but with a custom error message printed when the test fails. Read more

Used specify custom error messages that depend on the errors produced by FromStr. Read more

Ensures that input is within a range, array or vector. Read more

Does the same thing as InputBuild::inside, but with a custom error message printed when input fails. Read more

Toggles whether a prompt message gets printed once or each time input is requested.

Send prompts to custom writer instead of stdout

Send prompts to stderr instead of stdout

Sets a minimum input value.

Sets a minimum input value with custom error message.

Sets a maximum input value.

Sets a maximum input value with custom error message.

Sets a minimum and maximum input value.

Sets a minimum and maximum input value with custom error message.

Sets a restricted input value.

Sets a restricted input value with custom error message.

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.