Add assert to Vec with_capacity docs

This commit is contained in:
Ivan Tham 2020-06-03 01:29:02 +08:00
parent eeaf497b2a
commit 596b0c88cc

View File

@ -348,9 +348,11 @@ impl<T> Vec<T> {
/// for i in 0..10 {
/// vec.push(i);
/// }
/// assert_eq!(vec.capacity(), 10);
///
/// // ...but this may make the vector reallocate
/// vec.push(11);
/// assert!(vec.capacity() >= 11);
/// ```
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]