impl From<&CStr> for CString
This commit is contained in:
parent
43ab6c7d5a
commit
965556d162
@ -522,6 +522,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;
|
||||
@ -532,13 +539,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 {
|
||||
|
Loading…
Reference in New Issue
Block a user