memea::db

Function prompt

Source
pub fn prompt<T>(message: &str) -> T
where T: FromStr, <T as FromStr>::Err: Display,
Expand description

Prompts the user for input and parses it to the specified type.

This function displays a formatted prompt and continues asking for input until a valid value of type T is entered.

§Arguments

  • message - The prompt message to display to the user

§Returns

A value of type T parsed from user input

§Type Parameters

  • T - The type to parse the input into (must implement FromStr)