1
Fork 0

Add doc comments about safest way to initialize a vector of zeros

This commit is contained in:
mandeep 2018-10-05 18:22:19 -04:00
parent 2155f27b64
commit 82444aa753

View file

@ -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];