Skip to content

Commit

Permalink
Add doc example for OsString::reserve_exact.
Browse files Browse the repository at this point in the history
  • Loading branch information
frewsxcv committed Mar 14, 2017
1 parent 4d57d92 commit 5537955
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/libstd/ffi/os_str.rs
Expand Up @@ -210,6 +210,16 @@ impl OsString {
/// Note that the allocator may give the collection more space than it
/// requests. Therefore capacity can not be relied upon to be precisely
/// minimal. Prefer reserve if future insertions are expected.
///
/// # Examples
///
/// ```
/// use std::ffi::OsString;
///
/// let mut s = OsString::new();
/// s.reserve_exact(10);
/// assert!(s.capacity() >= 10);
/// ```
#[stable(feature = "osstring_simple_functions", since = "1.9.0")]
pub fn reserve_exact(&mut self, additional: usize) {
self.inner.reserve_exact(additional)
Expand Down

0 comments on commit 5537955

Please sign in to comment.