Use assertions on Vec doc
Clarify what the state of Vec after with_capacity on doc.
This commit is contained in:
parent
1dc748fb3d
commit
12b4cf8c6c
1 changed files with 4 additions and 2 deletions
|
@ -116,8 +116,10 @@ use crate::raw_vec::RawVec;
|
|||
/// assert_eq!(vec, [0, 0, 0, 0, 0]);
|
||||
///
|
||||
/// // The following is equivalent, but potentially slower:
|
||||
/// let mut vec1 = Vec::with_capacity(5);
|
||||
/// vec1.resize(5, 0);
|
||||
/// let mut vec = Vec::with_capacity(5);
|
||||
/// assert_eq!(vec, []);
|
||||
/// vec.resize(5, 0);
|
||||
/// assert_eq!(vec, [0, 0, 0, 0, 0]);
|
||||
/// ```
|
||||
///
|
||||
/// Use a `Vec<T>` as an efficient stack:
|
||||
|
|
Loading…
Add table
Reference in a new issue