mirror of
https://github.com/rust-lang/rust.git
synced 2026-06-01 14:10:03 +03:00
Add doc example for OsString::reserve.
This commit is contained in:
@@ -188,6 +188,16 @@ pub fn capacity(&self) -> usize {
|
||||
/// 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)
|
||||
|
||||
Reference in New Issue
Block a user