Add cstring_from_cow_cstr and osstring_from_cow_osstr
This commit is contained in:
parent
1133a149f1
commit
ea8131de53
2 changed files with 16 additions and 0 deletions
|
|
@ -682,6 +682,14 @@ impl Borrow<CStr> for CString {
|
|||
fn borrow(&self) -> &CStr { self }
|
||||
}
|
||||
|
||||
#[stable(feature = "cstring_from_cow_cstr", since = "1.28.0")]
|
||||
impl<'a> From<Cow<'a, CStr>> for CString {
|
||||
#[inline]
|
||||
fn from(s: Cow<'a, CStr>) -> Self {
|
||||
s.into_owned()
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "box_from_c_str", since = "1.17.0")]
|
||||
impl<'a> From<&'a CStr> for Box<CStr> {
|
||||
fn from(s: &'a CStr) -> Box<CStr> {
|
||||
|
|
|
|||
|
|
@ -688,6 +688,14 @@ impl<'a> From<&'a OsString> for Cow<'a, OsStr> {
|
|||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "osstring_from_cow_osstr", since = "1.28.0")]
|
||||
impl<'a> From<Cow<'a, OsStr>> for OsString {
|
||||
#[inline]
|
||||
fn from(s: Cow<'a, OsStr>) -> Self {
|
||||
s.into_owned()
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "box_default_extra", since = "1.17.0")]
|
||||
impl Default for Box<OsStr> {
|
||||
fn default() -> Box<OsStr> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue