diff options
| author | ash <97464181+Borgerr@users.noreply.github.com> | 2024-06-25 07:34:35 -0600 |
|---|---|---|
| committer | ash <97464181+Borgerr@users.noreply.github.com> | 2024-06-25 07:36:34 -0600 |
| commit | aa46a3368eb017eba41bfab956c7787d46c09935 (patch) | |
| tree | d35402a118f084f15479a264ddbdf393deae819b /library/std/src/ffi/os_str.rs | |
| parent | 7e187e8e4b0a12b9adc0d24dc30dffde6ceaba4a (diff) | |
| download | rust-aa46a3368eb017eba41bfab956c7787d46c09935.tar.gz rust-aa46a3368eb017eba41bfab956c7787d46c09935.zip | |
`PathBuf::as_mut_vec` removed and verified for UEFI and Windows platforms #126333
Diffstat (limited to 'library/std/src/ffi/os_str.rs')
| -rw-r--r-- | library/std/src/ffi/os_str.rs | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/library/std/src/ffi/os_str.rs b/library/std/src/ffi/os_str.rs index 318fe205e0f..4a417c84a30 100644 --- a/library/std/src/ffi/os_str.rs +++ b/library/std/src/ffi/os_str.rs @@ -552,15 +552,20 @@ impl OsString { OsStr::from_inner_mut(self.inner.leak()) } - /// Part of a hack to make PathBuf::push/pop more efficient. + /// Provides plumbing to core `Vec::truncate`. + /// More well behaving alternative to allowing outer types + /// full mutable access to the core `Vec`. #[inline] - pub(crate) fn as_mut_vec_for_path_buf(&mut self) -> &mut Vec<u8> { - self.inner.as_mut_vec_for_path_buf() + pub(crate) fn truncate(&mut self, len: usize) { + self.inner.truncate(len); } + /// Provides plumbing to core `Vec::extend_from_slice`. + /// More well behaving alternative to allowing outer types + /// full mutable access to the core `Vec`. #[inline] - pub(crate) fn truncate(&mut self, len: usize) { - self.inner.truncate(len); + pub(crate) fn extend_from_slice(&mut self, other: &[u8]) { + self.inner.extend_from_slice(other); } } |
