Add doc example for OsString::reserve
.
This commit is contained in:
parent
9a7b789c37
commit
4d57d92f07
1 changed files with 10 additions and 0 deletions
|
@ -188,6 +188,16 @@ impl OsString {
|
||||||
/// in the given `OsString`.
|
/// in the given `OsString`.
|
||||||
///
|
///
|
||||||
/// The collection may reserve more space to avoid frequent reallocations.
|
/// 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")]
|
#[stable(feature = "osstring_simple_functions", since = "1.9.0")]
|
||||||
pub fn reserve(&mut self, additional: usize) {
|
pub fn reserve(&mut self, additional: usize) {
|
||||||
self.inner.reserve(additional)
|
self.inner.reserve(additional)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue