We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
ToString for char
1 parent 2935d29 commit e5c5df8Copy full SHA for e5c5df8
src/liballoc/string.rs
@@ -2228,6 +2228,14 @@ impl<T: fmt::Display + ?Sized> ToString for T {
2228
}
2229
2230
2231
+#[stable(feature = "char_to_string_specialization", since = "1.46.0")]
2232
+impl ToString for char {
2233
+ #[inline]
2234
+ fn to_string(&self) -> String {
2235
+ String::from(self.encode_utf8(&mut [0; 4]))
2236
+ }
2237
+}
2238
+
2239
#[stable(feature = "str_to_string_specialization", since = "1.9.0")]
2240
impl ToString for str {
2241
#[inline]
0 commit comments