Expand description
Utilities for reading user input
Functions§
- read_
all - Prints a message and prompt to the console Returns all characters from stdin Panics if stdin can’t be read
- read_
line - Prints a message and prompt to the console Returns one line entered from stdin Includes the newline character, use .trim() to remove msg and prompt are separated because you usually want to provide msg from a list and prompt is usually the same, this alleviates the need for a read_line(format!(()) Panics if stdin can’t be read
- read_
num - Prints a message and prompt to the console Reads num_bytes of stdin to a string Returns Err if read buffer couldn’t be converted to valid utf8 Note: num_bytes may not correspond with resulting string length due to multibyte characters Panics if stdin can’t be read