]> git.lizzy.rs Git - rust.git/commitdiff
OsString::shrink_to_fit.
authorClar Charr <clar@charr.xyz>
Fri, 10 Mar 2017 05:23:54 +0000 (00:23 -0500)
committerClar Charr <clar@charr.xyz>
Fri, 10 Mar 2017 17:15:30 +0000 (12:15 -0500)
src/libstd/ffi/os_str.rs
src/libstd/sys/redox/os_str.rs
src/libstd/sys/unix/os_str.rs
src/libstd/sys/windows/os_str.rs
src/libstd/sys_common/wtf8.rs

index 7b8bf42e0a74a5d3f1d485f8553c8a8ef1e34fe4..41bdd9c51d458e1c9d85f34cfdd1f0cc1ec6386a 100644 (file)
@@ -205,6 +205,12 @@ pub fn reserve_exact(&mut self, additional: usize) {
         self.inner.reserve_exact(additional)
     }
 
+    /// Shrinks the capacity of the `OsString` to match its length.
+    #[unstable(feature = "osstring_shrink_to_fit", issue = "40421")]
+    pub fn shrink_to_fit(&mut self) {
+        self.inner.shrink_to_fit()
+    }
+
     /// Converts this `OsString` into a boxed `OsStr`.
     #[unstable(feature = "into_boxed_os_str", issue = "0")]
     pub fn into_boxed_os_str(self) -> Box<OsStr> {
index 0f967863899cb071f3565e39b3ece9e4fa0290ac..474d59eed83d1daa3bf3b8b00b6e73edec840688 100644 (file)
@@ -83,6 +83,11 @@ pub fn reserve_exact(&mut self, additional: usize) {
         self.inner.reserve_exact(additional)
     }
 
+    #[inline]
+    pub fn shrink_to_fit(&mut self) {
+        self.inner.shrink_to_fit()
+    }
+
     pub fn as_slice(&self) -> &Slice {
         unsafe { mem::transmute(&*self.inner) }
     }
index 938bcfc6d162e958903a34d65db4078d4de0e352..c27599ec0206f8ae46b581c658e80fa215b7ebe2 100644 (file)
@@ -83,6 +83,11 @@ pub fn reserve_exact(&mut self, additional: usize) {
         self.inner.reserve_exact(additional)
     }
 
+    #[inline]
+    pub fn shrink_to_fit(&mut self) {
+        self.inner.shrink_to_fit()
+    }
+
     pub fn as_slice(&self) -> &Slice {
         unsafe { mem::transmute(&*self.inner) }
     }
index 04e45dcf549631df7a0ce6436c3cd0c574ebb5ca..b02b06e1ef2e1510aed1b7885a9efaf70655f9ac 100644 (file)
@@ -89,6 +89,10 @@ pub fn reserve_exact(&mut self, additional: usize) {
         self.inner.reserve_exact(additional)
     }
 
+    pub fn shrink_to_fit(&mut self) {
+        self.inner.shrink_to_fit()
+    }
+
     #[inline]
     pub fn into_box(self) -> Box<Slice> {
         unsafe { mem::transmute(self.inner.into_box()) }
index 1d61181a4ee0f96db5f8a4a063410a837f61176f..b486d4ffda3fd61c239b94d61f9a03e9b758e52e 100644 (file)
@@ -236,6 +236,11 @@ pub fn reserve_exact(&mut self, additional: usize) {
         self.bytes.reserve_exact(additional)
     }
 
+    #[inline]
+    pub fn shrink_to_fit(&mut self) {
+        self.bytes.shrink_to_fit()
+    }
+
     /// Returns the number of bytes that this string buffer can hold without reallocating.
     #[inline]
     pub fn capacity(&self) -> usize {