Functionsยง
- prompt
- Prompts the user with the given message and waits up to
wait_secsseconds for a key press. ReturnsOk(Some(c))if a key is pressed, orOk(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.