diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2017-03-10 16:51:46 -0600 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2017-03-10 20:05:06 -0800 |
| commit | f4b4e097a6dcc5ffac6f3b34c91423708014c553 (patch) | |
| tree | 105064d6510e014756352035f3e95ad0b8925ecf /src/libstd/sys_common | |
| parent | dcf41821b88bc9c54aaa621f7e744405a33e2238 (diff) | |
| parent | 83814fd8ab30e2744d2fb17bdcf5b59840673863 (diff) | |
Rollup merge of #40410 - clarcharr:os_string_shrink_to_fit, r=alexcrichton
OsString::shrink_to_fit. Considering how the other capacity-related methods are there, I found it odd that this one wasn't included. Will create a tracking issue once I get an OK on this.
Diffstat (limited to 'src/libstd/sys_common')
| -rw-r--r-- | src/libstd/sys_common/wtf8.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/libstd/sys_common/wtf8.rs b/src/libstd/sys_common/wtf8.rs index 1d61181a4ee..b486d4ffda3 100644 --- a/src/libstd/sys_common/wtf8.rs +++ b/src/libstd/sys_common/wtf8.rs @@ -236,6 +236,11 @@ impl Wtf8Buf { 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 { |
