UserIO.getInput

Gets input from the user, and uses the given ArgBinder (or the default one, if one isn't passed) to convert the string to a T.

Notes: Because ArgBinder is responsible for the conversion, if for example you wanted T to be a custom struct, then you could create an @ArgBinderFunc to perform the conversion, and then this function (and all UserIO.getInput variants) will be able to convert the user's input to that type.

See also the documentation for ArgBinder.

class UserIO
static
T
getInput
(
T
Binder = ArgBinder!()
)
(
string prompt
)
if (
isInstanceOf!(ArgBinder, Binder)
)

Parameters

T

The type to conver the string to, via Binder.

Binder

The ArgBinder that knows how to convert a string -> T.

prompt string

The prompt to display to the user, note that no extra characters or spaces are added, the prompt is shown as-is.

Return Value

Type: T

A T that was created by the user's input given to Binder.

Meta