Module e_prompts

Source

Functionsยง

prompt
Prompts the user with the given message and waits up to wait_secs seconds for a key press. Returns Ok(Some(c)) if a key is pressed, or Ok(None) if the timeout expires.
prompt_line
Reads an entire line from the user with a timeout of wait_secs. Returns Ok(Some(String)) if input is received, or Ok(None) if the timeout expires.
prompt_line_with_poll
Prompts the user for a full line of input using crossterm events with a timeout. This works cross-platform and avoids leftover input from a lingering blocking thread.
prompt_line_with_poll_opts
Prompts the user for a full line of input using crossterm events (raw mode) with a timeout.
read_line_with_timeout
Reads a line from standard input with a timeout. Returns Ok(Some(String)) if a line is read before the timeout, Ok(None) if the timeout expires, or an error.
yesno
Prompts the user with a yes/no question and returns true if the user answers yes, false if no, or None if the timeout expires or an error occurs.