Skip to content

Commit

Permalink
Add doc example for OsString::reserve.
Browse files Browse the repository at this point in the history
  • Loading branch information
frewsxcv committed Mar 14, 2017
1 parent 9a7b789 commit 4d57d92
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/libstd/ffi/os_str.rs
Expand Up @@ -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)
Expand Down

0 comments on commit 4d57d92

Please sign in to comment.