]> git.lizzy.rs Git - rust.git/commitdiff
Add doc comments about safest way to initialize a vector of zeros
authormandeep <mandeep@users.noreply.github.com>
Fri, 5 Oct 2018 22:22:19 +0000 (18:22 -0400)
committermandeep <mandeep@users.noreply.github.com>
Fri, 5 Oct 2018 22:22:19 +0000 (18:22 -0400)
src/liballoc/vec.rs

index 2bc037e3fee126343715212911c8b62e1d28867e..3188de512662c9290deafc77bc3b39fbdc4d3f75 100644 (file)
 /// 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];