We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8836048 commit 6988bcdCopy full SHA for 6988bcd
src/librustrt/c_str.rs
@@ -73,6 +73,7 @@ use collections::hash;
73
use core::kinds::marker;
74
use core::mem;
75
use core::ptr;
76
+use core::fmt;
77
use core::raw::Slice;
78
use core::slice;
79
use core::str;
@@ -344,6 +345,12 @@ impl Collection for CString {
344
345
}
346
347
348
+impl fmt::Show for CString {
349
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
350
+ String::from_utf8_lossy(self.as_bytes_no_nul()).fmt(f)
351
+ }
352
+}
353
+
354
/// A generic trait for converting a value to a CString.
355
pub trait ToCStr {
356
/// Copy the receiver into a CString.
0 commit comments