File tree 5 files changed +25
-0
lines changed
5 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -205,6 +205,12 @@ impl OsString {
205
205
self . inner . reserve_exact ( additional)
206
206
}
207
207
208
+ /// Shrinks the capacity of the `OsString` to match its length.
209
+ #[ unstable( feature = "osstring_shrink_to_fit" , issue = "40421" ) ]
210
+ pub fn shrink_to_fit ( & mut self ) {
211
+ self . inner . shrink_to_fit ( )
212
+ }
213
+
208
214
/// Converts this `OsString` into a boxed `OsStr`.
209
215
#[ unstable( feature = "into_boxed_os_str" , issue = "0" ) ]
210
216
pub fn into_boxed_os_str ( self ) -> Box < OsStr > {
Original file line number Diff line number Diff line change @@ -83,6 +83,11 @@ impl Buf {
83
83
self . inner . reserve_exact ( additional)
84
84
}
85
85
86
+ #[ inline]
87
+ pub fn shrink_to_fit ( & mut self ) {
88
+ self . inner . shrink_to_fit ( )
89
+ }
90
+
86
91
pub fn as_slice ( & self ) -> & Slice {
87
92
unsafe { mem:: transmute ( & * self . inner ) }
88
93
}
Original file line number Diff line number Diff line change @@ -83,6 +83,11 @@ impl Buf {
83
83
self . inner . reserve_exact ( additional)
84
84
}
85
85
86
+ #[ inline]
87
+ pub fn shrink_to_fit ( & mut self ) {
88
+ self . inner . shrink_to_fit ( )
89
+ }
90
+
86
91
pub fn as_slice ( & self ) -> & Slice {
87
92
unsafe { mem:: transmute ( & * self . inner ) }
88
93
}
Original file line number Diff line number Diff line change @@ -89,6 +89,10 @@ impl Buf {
89
89
self . inner . reserve_exact ( additional)
90
90
}
91
91
92
+ pub fn shrink_to_fit ( & mut self ) {
93
+ self . inner . shrink_to_fit ( )
94
+ }
95
+
92
96
#[ inline]
93
97
pub fn into_box ( self ) -> Box < Slice > {
94
98
unsafe { mem:: transmute ( self . inner . into_box ( ) ) }
Original file line number Diff line number Diff line change @@ -236,6 +236,11 @@ impl Wtf8Buf {
236
236
self . bytes . reserve_exact ( additional)
237
237
}
238
238
239
+ #[ inline]
240
+ pub fn shrink_to_fit ( & mut self ) {
241
+ self . bytes . shrink_to_fit ( )
242
+ }
243
+
239
244
/// Returns the number of bytes that this string buffer can hold without reallocating.
240
245
#[ inline]
241
246
pub fn capacity ( & self ) -> usize {
You can’t perform that action at this time.
0 commit comments