Function read_line

Source
pub fn read_line() -> String
Expand description

Reads a single line from the standard input.

The terminating \n character is preserved, but will be absent on end of input.

§Panics

This function panics if an error occurs whilst reading the standard input of the program.

§Examples

Reading a single line:

let line = ftkit::read_line();
println!("You just wrote: {}", line.trim());

Reading lines until the End-Of-File:

loop {
    let line = ftkit::read_line();
    if line.is_empty() {
        break;
    }
    println!("You just wrote: {}", line.trim());
}