Add doc example for `OsString::reserve`.

This commit is contained in:
Corey Farwell 2017-03-12 16:21:34 -04:00
parent 9a7b789c37
commit 4d57d92f07
1 changed files with 10 additions and 0 deletions

View File

@ -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)