Function brane_shr::input::input

source ·
pub fn input<S, VA>(
    what: impl Display,
    prompt: impl ToString,
    default: Option<impl Into<S>>,
    validator: Option<VA>,
    history: Option<impl History<String>>,
) -> Result<S, Error>
where S: FromStr + ToString, S::Err: Error, VA: InputValidator<String>, VA::Err: ToString,
Expand description

Prompts the user for a string.

§Generic arguments

  • S: The FromStr-capable type to query.

§Arguments

  • what: Some string description to show to the user that tells them what kind of thing they are inputting. Should fill in: Invalid .... Only used in the case they fail the first time.
  • prompt: The prompt to display to the user.
  • default: Any default value to give, or else None.
  • validator: A validator that implements the dialoguer::InputValidator trait, or None if it is not possible. You can use the NoValidator concrete type when using no validator like so None::<NoValidator>
  • history: An optional History-capabable struct that can be used to keep track of this prompt’s history.

§Returns

The users inputted value for S.

§Errors

This function errors if we failed to interact with the user.