diff options
| author | Eduardo Sánchez Muñoz <eduardosm-dev@e64.io> | 2024-10-22 21:14:22 +0200 |
|---|---|---|
| committer | Eduardo Sánchez Muñoz <eduardosm-dev@e64.io> | 2024-10-29 21:24:12 +0100 |
| commit | 9fe9041cc8eddaed402d17aa4facb2ce8f222e95 (patch) | |
| tree | 2c5f1588efbefffd043e3e4e9c3d731962b5a806 /library/std/src/ffi | |
| parent | 2dece5bb62f234f5622a08289c5a3d1555cd7843 (diff) | |
| download | rust-9fe9041cc8eddaed402d17aa4facb2ce8f222e95.tar.gz rust-9fe9041cc8eddaed402d17aa4facb2ce8f222e95.zip | |
Implement `From<&mut {slice}>` for `Box/Rc/Arc<{slice}>`
Diffstat (limited to 'library/std/src/ffi')
| -rw-r--r-- | library/std/src/ffi/os_str.rs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/library/std/src/ffi/os_str.rs b/library/std/src/ffi/os_str.rs index 2243f100643..b19d482feaa 100644 --- a/library/std/src/ffi/os_str.rs +++ b/library/std/src/ffi/os_str.rs @@ -1225,6 +1225,15 @@ impl From<&OsStr> for Box<OsStr> { } } +#[stable(feature = "box_from_mut_slice", since = "CURRENT_RUSTC_VERSION")] +impl From<&mut OsStr> for Box<OsStr> { + /// Copies the string into a newly allocated <code>[Box]<[OsStr]></code>. + #[inline] + fn from(s: &mut OsStr) -> Box<OsStr> { + Self::from(&*s) + } +} + #[stable(feature = "box_from_cow", since = "1.45.0")] impl From<Cow<'_, OsStr>> for Box<OsStr> { /// Converts a `Cow<'a, OsStr>` into a <code>[Box]<[OsStr]></code>, @@ -1296,6 +1305,15 @@ impl From<&OsStr> for Arc<OsStr> { } } +#[stable(feature = "shared_from_mut_slice", since = "CURRENT_RUSTC_VERSION")] +impl From<&mut OsStr> for Arc<OsStr> { + /// Copies the string into a newly allocated <code>[Arc]<[OsStr]></code>. + #[inline] + fn from(s: &mut OsStr) -> Arc<OsStr> { + Arc::from(&*s) + } +} + #[stable(feature = "shared_from_slice2", since = "1.24.0")] impl From<OsString> for Rc<OsStr> { /// Converts an [`OsString`] into an <code>[Rc]<[OsStr]></code> by moving the [`OsString`] @@ -1317,6 +1335,15 @@ impl From<&OsStr> for Rc<OsStr> { } } +#[stable(feature = "shared_from_mut_slice", since = "CURRENT_RUSTC_VERSION")] +impl From<&mut OsStr> for Rc<OsStr> { + /// Copies the string into a newly allocated <code>[Rc]<[OsStr]></code>. + #[inline] + fn from(s: &mut OsStr) -> Rc<OsStr> { + Rc::from(&*s) + } +} + #[stable(feature = "cow_from_osstr", since = "1.28.0")] impl<'a> From<OsString> for Cow<'a, OsStr> { /// Moves the string into a [`Cow::Owned`]. |
