about summary refs log tree commit diff
path: root/src/libstd/ffi
diff options
context:
space:
mode:
authorarcnmx <arcnmx@users.noreply.github.com>2015-12-31 13:56:21 -0500
committerarcnmx <arcnmx@users.noreply.github.com>2015-12-31 14:15:27 -0500
commit965556d1626a1ca26db08b1d4193ae9cc026223a (patch)
treeeaf3548863cdcb4dac6aee77518167e5848f728c /src/libstd/ffi
parent43ab6c7d5a9a9951de487baf49b91fd4b85e584d (diff)
impl From<&CStr> for CString
Diffstat (limited to 'src/libstd/ffi')
-rw-r--r--src/libstd/ffi/c_str.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/libstd/ffi/c_str.rs b/src/libstd/ffi/c_str.rs
index d2a885dc7fe..c8d43bfcef0 100644
--- a/src/libstd/ffi/c_str.rs
+++ b/src/libstd/ffi/c_str.rs
@@ -523,6 +523,13 @@ impl ToOwned for CStr {
 }
 
 #[unstable(feature = "cstring_asref", reason = "recently added", issue = "0")]
+impl<'a> From<&'a CStr> for CString {
+    fn from(s: &'a CStr) -> CString {
+        s.to_owned()
+    }
+}
+
+#[unstable(feature = "cstring_asref", reason = "recently added", issue = "0")]
 impl ops::Index<ops::RangeFull> for CString {
     type Output = CStr;
 
@@ -533,13 +540,6 @@ impl ops::Index<ops::RangeFull> for CString {
 }
 
 #[unstable(feature = "cstring_asref", reason = "recently added", issue = "0")]
-impl<'a, T: ?Sized + AsRef<CStr>> From<&'a T> for CString {
-    fn from(s: &'a T) -> CString {
-        s.as_ref().to_owned()
-    }
-}
-
-#[unstable(feature = "cstring_asref", reason = "recently added", issue = "0")]
 impl AsRef<CStr> for CStr {
     fn as_ref(&self) -> &CStr {
         self