pub fn prompt<T, S>(msg: S) -> Result<T, ReadlineError> where
    T: Promptable,
    S: AsRef<str>, 
Expand description

Prompt until input can be parsed as T.

Empty string input causes a re-prompt (including for String)

Examples

use promptly::prompt;

// Prompt until a non-empty string is provided
let name: String = prompt("Enter your name")?;

// Prompt for other `FromStr` types
let age: u32 = prompt("Enter your age")?;

Errors

Returns a ReadlineError if readline fails. Input that can’t be coerced into the specified type results in re-prompting.