diff options
| author | Corey Farwell <coreyf@rwell.org> | 2017-03-12 16:21:34 -0400 |
|---|---|---|
| committer | Corey Farwell <coreyf@rwell.org> | 2017-03-14 09:29:09 -0400 |
| commit | 4d57d92f071d24a4c189cc8aef897be25bcd9d55 (patch) | |
| tree | 96cbe66776c2c5f48a924a5c8283567b4e12fdbb /src/libstd/ffi | |
| parent | 9a7b789c3717146ca3ce3fca1eb23fa3a239f0fb (diff) | |
| download | rust-4d57d92f071d24a4c189cc8aef897be25bcd9d55.tar.gz rust-4d57d92f071d24a4c189cc8aef897be25bcd9d55.zip | |
Add doc example for `OsString::reserve`.
Diffstat (limited to 'src/libstd/ffi')
| -rw-r--r-- | src/libstd/ffi/os_str.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/libstd/ffi/os_str.rs b/src/libstd/ffi/os_str.rs index 3914f398961..bdd8ce5e6d8 100644 --- a/src/libstd/ffi/os_str.rs +++ b/src/libstd/ffi/os_str.rs @@ -188,6 +188,16 @@ impl OsString { /// in the given `OsString`. /// /// The collection may reserve more space to avoid frequent reallocations. + /// + /// # Examples + /// + /// ``` + /// use std::ffi::OsString; + /// + /// let mut s = OsString::new(); + /// s.reserve(10); + /// assert!(s.capacity() >= 10); + /// ``` #[stable(feature = "osstring_simple_functions", since = "1.9.0")] pub fn reserve(&mut self, additional: usize) { self.inner.reserve(additional) |
