Function read_char

Source
pub fn read_char(msg: Option<&str>) -> char
Expand description

§ARGUMENTS

‘msg’ (Option<&str>) - an optional message which will be printed at the same line as the input prompt. Must be set to Some(“…”) or None.

§DESCRIPTION

Prompts the user to type a character (char) which will then be returned.

Provides an information message on the same line as the prompt if Some(“…”) is provided, and just the prompt if None is provided.

§RETURNS

A single character (char) provided by the user.

§EXAMPLES

use quick_input::read_char;
let user_char_with_msg = read_char(Some("Please input a character: "));

let user_char: char = read_char(None);