impl From<&CStr> for CString
This commit is contained in:
parent
43ab6c7d5a
commit
965556d162
1 changed files with 7 additions and 7 deletions
|
@ -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")]
|
#[unstable(feature = "cstring_asref", reason = "recently added", issue = "0")]
|
||||||
impl ops::Index<ops::RangeFull> for CString {
|
impl ops::Index<ops::RangeFull> for CString {
|
||||||
type Output = CStr;
|
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")]
|
#[unstable(feature = "cstring_asref", reason = "recently added", issue = "0")]
|
||||||
impl AsRef<CStr> for CStr {
|
impl AsRef<CStr> for CStr {
|
||||||
fn as_ref(&self) -> &CStr {
|
fn as_ref(&self) -> &CStr {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue