What is the correct way to return an Iterator (or any other trait)?
I’ve found it useful to let the compiler guide me: fn to_words(text: &str) { // Note no return type text.split(‘ ‘) } Compiling gives: error[E0308]: mismatched types –> src/lib.rs:5:5 | 5 | text.split(‘ ‘) | ^^^^^^^^^^^^^^^ expected (), found struct `std::str::Split` | = note: expected type `()` found type `std::str::Split<‘_, char>` help: try adding a … Read more