Add doc comments about safest way to initialize a vector of zeros
This commit is contained in:
parent
2155f27b64
commit
82444aa753
1 changed files with 3 additions and 1 deletions
|
@ -120,7 +120,9 @@ use raw_vec::RawVec;
|
|||
/// assert_eq!(vec, [1, 2, 3, 4]);
|
||||
/// ```
|
||||
///
|
||||
/// It can also initialize each element of a `Vec<T>` with a given value:
|
||||
/// It can also initialize each element of a `Vec<T>` with a given value.
|
||||
/// Initializing a `Vec<T>` in this manner is the most efficient and safest way to allocate a
|
||||
/// vector of zeros as previously zeroed memory is requested from the operating system:
|
||||
///
|
||||
/// ```
|
||||
/// let vec = vec![0; 5];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue