I want to read one line from stdin, then split it by whitespaces and process these parts.
A simple read_line would work since it returns a owned String:
fn read_line() -> String {
let mut str: String = String::new();
stdin().read_line(&mut str).unwrap();
return str;
}
But I couldn’t make it when I want to consume the String and return a owned Split whose lifetime goes out of the function that creates it.
New contributor