We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2a5cbb0 commit 29ab6b7Copy full SHA for 29ab6b7
src/liballoc/vec.rs
@@ -343,15 +343,18 @@ impl<T> Vec<T> {
343
///
344
/// // The vector contains no items, even though it has capacity for more
345
/// assert_eq!(vec.len(), 0);
346
+ /// assert_eq!(vec.capacity(), 10);
347
348
/// // These are all done without reallocating...
349
/// for i in 0..10 {
350
/// vec.push(i);
351
/// }
352
+ /// assert_eq!(vec.len(), 10);
353
/// assert_eq!(vec.capacity(), 10);
354
355
/// // ...but this may make the vector reallocate
356
/// vec.push(11);
357
+ /// assert_eq!(vec.len(), 11);
358
/// assert!(vec.capacity() >= 11);
359
/// ```
360
#[inline]
0 commit comments