Here’s a Rust error:
error: the trait
core::ops::Fn(char) -> bool
is not implemented for the type&str
I was trying to split a string of numbers with spaces a delimiter. Here’s the line for which this error occured:
1 |
let split: Vec<&str> = input_string.as_slice().split(" ").collect(); |
Apparently, split was expecting a single character, not a substring. This obtuse error was easily solved by changing the double-quotes to single-quotes.
1 |
let split: Vec<&str> = input_string.as_slice().split(' ').collect(); |