Function prompt_rust::prompt

source ·
pub fn prompt<T: FromStr>(prompt: &str) -> Result<T, PromptError<T>>where
    T::Err: Debug + Display,
Expand description

A function to prompt for prompt and read a line from stdin, parsing it into a specified type.

Arguments

  • prompt - A prompt to display before reading prompt.

Errors

This function will return an error if there’s an issue with reading from stdin or parsing the prompt into the desired type.