Mention vec![x; len] syntax in Vec docs
This commit is contained in:
parent
68fc2d98d5
commit
48606e3ecd
1 changed files with 7 additions and 0 deletions
|
|
@ -112,6 +112,13 @@ use super::range::RangeArgument;
|
|||
/// assert_eq!(vec, [1, 2, 3, 4]);
|
||||
/// ```
|
||||
///
|
||||
/// It can also initialize each element of a `Vec<T>` with a given value:
|
||||
///
|
||||
/// ```
|
||||
/// let vec = vec![0; 5];
|
||||
/// assert_eq!(vec, [0, 0, 0, 0, 0]);
|
||||
/// ```
|
||||
///
|
||||
/// Use a `Vec<T>` as an efficient stack:
|
||||
///
|
||||
/// ```
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue