diff options
| author | Matt Brubeck <mbrubeck@limpet.net> | 2018-06-29 11:49:32 -0700 |
|---|---|---|
| committer | Matt Brubeck <mbrubeck@limpet.net> | 2018-07-06 12:57:47 -0700 |
| commit | cdff2f3b3083f602736653e1428b5113dd2e7eee (patch) | |
| tree | fa8cbcc5a463ddd0475d49d17028e16a8a87fcc2 /src/libstd/ffi | |
| parent | 5fdcd3aa389aa92879f576c55e429015667143c3 (diff) | |
| download | rust-cdff2f3b3083f602736653e1428b5113dd2e7eee.tar.gz rust-cdff2f3b3083f602736653e1428b5113dd2e7eee.zip | |
impl Clone for Box<CStr>, Box<OsStr>, Box<Path>
Implements #51908.
Diffstat (limited to 'src/libstd/ffi')
| -rw-r--r-- | src/libstd/ffi/c_str.rs | 8 | ||||
| -rw-r--r-- | src/libstd/ffi/os_str.rs | 8 |
2 files changed, 16 insertions, 0 deletions
diff --git a/src/libstd/ffi/c_str.rs b/src/libstd/ffi/c_str.rs index 6513d11dd51..b816f4b7850 100644 --- a/src/libstd/ffi/c_str.rs +++ b/src/libstd/ffi/c_str.rs @@ -706,6 +706,14 @@ impl From<Box<CStr>> for CString { } } +#[stable(feature = "more_box_slice_clone", since = "1.29.0")] +impl Clone for Box<CStr> { + #[inline] + fn clone(&self) -> Self { + (**self).into() + } +} + #[stable(feature = "box_from_c_string", since = "1.20.0")] impl From<CString> for Box<CStr> { #[inline] diff --git a/src/libstd/ffi/os_str.rs b/src/libstd/ffi/os_str.rs index 0a3148029d0..b522d134837 100644 --- a/src/libstd/ffi/os_str.rs +++ b/src/libstd/ffi/os_str.rs @@ -628,6 +628,14 @@ impl From<OsString> for Box<OsStr> { } } +#[stable(feature = "more_box_slice_clone", since = "1.29.0")] +impl Clone for Box<OsStr> { + #[inline] + fn clone(&self) -> Self { + self.to_os_string().into_boxed_os_str() + } +} + #[stable(feature = "shared_from_slice2", since = "1.24.0")] impl From<OsString> for Arc<OsStr> { #[inline] |
