I am trying to collect vector of string to string with separator $
.
let v = [String::from("bump"), String::from("sage"),String::from("lol"), String::from(" kek ")];
let s: String = v.into_iter().map(|x| x.push_str("$")).collect();
println!("{:?}",s );
The code above does not work, but this:
let v = [String::from("hello"), String::from("world"),String::from("shit"), String::from(" +15 ")];
let s: String = v.into_iter().collect();
println!("{:?}",s );
is working. How do I solve this problem?