Why iterating over the string slice is not possible?
fn main() {
let text = "abcd";
for (i, c) in text.iter().enumerate() {
// ...
}
}
gives an error
error[E0599]: no method named `iter` found for reference `&str` in the current scope
--> src/main.rs:3:24
|
3 | for (i, c) in text.iter().enumerate() {
| ^^^^ method not found in `&str`
How do I make the string slice iterable?