Hi, I want to sort char in a String, e.g. input "acdbe", output "abcde". I changed &str to Vec<char>, sort it, then concat() it. But compiler said Output Type is not specified, how to solve it? Thanks!
BTW, is there any simpler approach?
fn main () {
let s = "acdbe";
let mut l:Vec<char> = s.chars().collect();
l.sort_unstable();
let j:String = l.concat();
println!("{}",j);
}
error[E0599]: the method `concat` exists for struct `Vec<char>`, but its trait bounds were not satisfied
--> src\main.rs:5:22
|
5 | let j:String = l.concat();
| ^^^^^^ method cannot be called on `Vec<char>` due to unsatisfied trait bounds
|
= note: the following trait bounds were not satisfied:
`<[char] as Concat<_>>::Output = _`