You don’t need to create an intermediate Vec<&str>, just map to_string() and use collect() after that:
let res: Vec<String> = my_string.split("something").map(|s| s.to_string()).collect();
You don’t need to create an intermediate Vec<&str>, just map to_string() and use collect() after that:
let res: Vec<String> = my_string.split("something").map(|s| s.to_string()).collect();