'How do I convert a char to a String?
Is there a succinct way to convert a char to a String in Rust other than:
let mut s = String::new();
s.push('c');
Solution 1:[1]
Since Rust 1.46, String implements From<char>, so you can alternatively use:
String::from('c')
or, with type inference,
'c'.into()
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | L. F. |
